Try it on paper first. A hint, the key idea and the worked solution are here when you need them.
A student designs a table of club members and stores the phone number 07700 900814 in a field Phone with the data type integer.
Phone have?DateOfBirth as text such as "3rd May". Suggest a better data type and give one reason.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. The phone number as an integer. An integer cannot keep the first , and it cannot hold the space. The number would be stored as , which is no longer the phone number. Nobody does arithmetic with a phone number either.
Step 2. The right type. Phone should be text (alphanumeric).
Step 3. The date of birth. Use the date/time data type. A date field can be sorted in date order and compared, for example to find members born before a given date. Text such as "3rd May" sorts in alphabetical order, which is not date order.
Answer: (a) the first and the space are lost. (b) Text. (c) Date/time, so dates sort and compare correctly.
Log in to join the discussion.
Loading…