Try it on paper first. A hint, the key idea and the worked solution are here when you need them.
A garden centre stores its plants in this table.
PlantCode Name Colour Height Price
GC01 Lily White 40 6.50
GC02 Fern Green 30 4.00
GC03 Rose Red 40 8.25
GC04 Lily Pink 35 6.50
GC05 Daisy White 25 3.75Height (in centimetres, always a whole number) and for Price (in dollars).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.
Step 1. Look for repeats.
Name: Lily appears twice. Not unique.Colour: White appears twice. Not unique.Height: appears twice. Not unique.Price: appears twice. Not unique.PlantCode: every value is different, and the codes are made to be unique.Step 2. Choose. PlantCode is the primary key. It identifies exactly one plant.
Step 3. Data types. Height is an integer, because it is always a whole number of centimetres. Price is real, because it has a decimal part.
Answer: (a) PlantCode; every other field has a repeated value. (b) Height integer, Price real.
Log in to join the discussion.
Loading…