Information Technology Topic

Field Data Types

  1. Read notes
  2. Flashcards
  3. Quiz
  4. Confident

Study focus - 3 things

  1. Every field has one data type, chosen before data is entered, and it decides what the field can hold
  2. The four types are alphanumeric (letters, digits and symbols), numeric (whole or decimal numbers), date (real calendar dates) and logical (two values such as Yes or No)
  3. Choose the type from the values the field will hold and what you need to do with them: numbers you calculate with are numeric, but telephone numbers and codes are alphanumeric

Section 1What a data type is

A data type is a rule that says what kind of value a field can hold. When you design a table you give each field a name and a data type, and you do this before any data is entered. Every value in a field is then the same kind of value. The Price field holds only numbers, and the Surname field holds only text. The four types you need are alphanumeric, numeric, date and logical. Here's the trick: look at an example value and ask what it is. Letters and symbols, a number, a calendar date, or a yes/no.

Section 2Alphanumeric fields

An alphanumeric field holds text: letters, digits and symbols in any mix. Many programs simply call this a text or character field. Surnames, addresses, e-mail addresses and codes such as M001 are all alphanumeric. A telephone number such as 876-555-0101 is also alphanumeric. It has hyphens in it, and you never add two telephone numbers together. Identification codes with letters in them are the same. Watch out: a value made only of digits is not automatically numeric. Ask whether you will do arithmetic with it.

Section 3Numeric fields

A numeric field holds numbers that you can calculate with: add, average, compare. There are two kinds. A whole number has no decimal part, such as the quantity 24. A decimal number has a decimal part, such as the fee 4500.00 or a price of 2750.50. If cents matter, use a decimal number. In the Member table, AnnualFee is numeric, which is why the club can total the fees. The fees of the four members who have paid add up to 16,500. Easy to mix up: 4500.00 is a number, but 4500 dollars is text, because of the letters.

Section 4Date fields

A date field holds a real calendar date, such as 15/03/2026 (day/month/year). Storing dates in a date field, and not as plain text, means the program can check them. 31/04/2026 is not a real date because April has 30 days, and 29/02/2026 is not real because 2026 is not a leap year. A date field should not accept these. A date field also lets you compare dates. In the Member table, DateJoined shows that M001 joined before M003. Here's the trick: if the value is a day on a calendar, use a date field.

Section 5Logical fields

A logical field holds one of only two values: yes or no, true or false. In the Member table, PaidUp is a logical field with the values Yes and No. Use a logical field when the question can only be answered one of two ways. Is the member a prefect? Has the fee been paid? Is the item in stock? Values like Maybe or Half do not fit. If a third answer is needed, the field is not logical, it is alphanumeric. Counting is easy: in the Member table four members have PaidUp = Yes and two have No.

Section 6Choosing the right type

The Member table of a Portmore sports club (MemberID, Surname, Phone, AnnualFee, DateJoined, PaidUp) holds: M001, Brown, 876-555-0101, 4500.00, 02/09/2025, Yes; M002, Campbell, 876-555-0144, 4500.00, 15/09/2025, No; M003, Reid, 876-555-0119, 3000.00, 03/10/2025, Yes; M004, Gordon, 876-555-0188, 4500.00, 21/10/2025, Yes; M005, Francis, 876-555-0162, 3000.00, 12/01/2026, No; M006, Allen, 876-555-0127, 4500.00, 28/01/2026, Yes. Dates are written day/month/year and fees are in J$. The types are: MemberID alphanumeric, Surname alphanumeric, Phone alphanumeric, AnnualFee numeric, DateJoined date, PaidUp logical. That is 3 alphanumeric fields and one of each other type. To choose, take a sample value and test it. Letters or hyphens: alphanumeric. A number you calculate with: numeric. A calendar day: date. Only two possible answers: logical. Choose carefully at the start. If you change a field's type after records exist, every existing value must be able to convert. Changing Phone to numeric would fail, because none of the six phone numbers is a plain number.

Examples

A Mandeville school club designs a table with these fields: MemberID (values like M014), Surname, Telephone (values like 876-555-0142), Quantity of tickets taken (24), Date of birth (14/05/2009) and Prefect (Yes or No). (a) Choose a data type for each field. (b) Explain why Telephone is not numeric.

(a) MemberID is alphanumeric because it has a letter. Surname is alphanumeric. Telephone is alphanumeric. Quantity is numeric (a whole number). Date of birth is a date. Prefect is logical because it has only two values. (b) A telephone number has hyphens, which are not digits, and you never calculate with it. A numeric field would not hold 876-555-0142, so it is alphanumeric.

The Member table of a Portmore sports club (MemberID, Surname, Phone, AnnualFee, DateJoined, PaidUp) holds: M001, Brown, 876-555-0101, 4500.00, 02/09/2025, Yes; M002, Campbell, 876-555-0144, 4500.00, 15/09/2025, No; M003, Reid, 876-555-0119, 3000.00, 03/10/2025, Yes; M004, Gordon, 876-555-0188, 4500.00, 21/10/2025, Yes; M005, Francis, 876-555-0162, 3000.00, 12/01/2026, No; M006, Allen, 876-555-0127, 4500.00, 28/01/2026, Yes. Dates are written day/month/year and fees are in J$. (a) How many fields are alphanumeric? (b) How many members have paid, and what is the total of their fees? (c) What is the total still owed by members who have not paid? (d) How many members joined in 2026? (e) Is 29/02/2026 a valid entry for DateJoined? Give a reason.

(a) MemberID, Surname and Phone, so 3. (b) PaidUp is Yes for M001, M003, M004 and M006, so 4 members. Their fees are 4500 + 3000 + 4500 + 4500 = 16500, that is J$16,500. (c) The members with No are M002 (4500) and M005 (3000), so 4500 + 3000 = 7500, that is J$7,500. (d) M005 (12/01/2026) and M006 (28/01/2026), so 2. (e) No. 2026 is not a leap year, so February has 28 days and 29/02/2026 is not a real date. A date field should reject it.

Now let's water it

Session runs notes to flashcards to quiz back-to-back.

Where this comes from