Try it on paper first. A hint, the key idea and the worked solution are here when you need them.
A shop gives every product a code: the letter P followed by a fixed number of digits, such as P0427. The shop sells products now and expects to sell three times as many in a few years. Every product must have its own code, because the code is the primary key.
The six basic data types are text (alphanumeric), character, Boolean, integer, real and date/time. Choose a type from what the values look like and what you will do with them. A primary key is a field whose value is unique in every record and never empty, so it identifies exactly one record.
Have you tried it?
Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, go through the solution one step at a time, and check each step against your own.
Given. products now, three times as many later. Codes are P and then digits.
Step 1. Products to cover. products.
Step 2. Try 4 digits. codes. That is fewer than , so two products would have to share a code. Not enough.
Step 3. Try 5 digits. codes. That is more than . So digits are needed.
Check. A primary key must be unique, so the number of codes must be at least the number of products.
Answer: (a) products. (b) digits. (c) codes.
Log in to join the discussion.
Loading…