Field types
Depending on the information stored, the field type chosen to store it is very important.
Text field
- Stores words, numbers and other characters such as punctuation marks. Think of a text message in a mobile phone: this is similar to a string variable.
- Your address, your forename, your postcode and email address are all examples of Text Fields.
Number field
- Stores both whole numbers and decimal numbers. This is similar to a single/real/integer variable.
- Your height 1.62m (number field - real), the number of marks in your exam (62/100 number field - integer), and the number of days you have been absent from school (number field - integer)are all number fields.
Date field
- These store dates. A dentist’s database would keep track of all patients' details. If you are due a check-up, a date field would store when that is.
- Date of birth, the date of exams and events in a mobile phone calendar all use date fields.
Time field
- A time field stores a specific time.
- In a police report, the exact time when an incident took place would use a time field. Any important appointments and meetings would all use a time field to store start and finish times.
Graphic field
- A graphic field stores pictures and images. A picture on the school database, a profile picture on Facebook, and an image of a product on eBay would all be stored in a graphic field.
Calculated field
- This could have a type such as Number or Text, but the database works out what to put in there using a formula usually based on the contents of other fields in the record.
- For example, weekly wages may be calculated by multiplying an hourly pay rate by the number of hours worked.
- The percentage of attendance at school, age, and weekly wages would all be calculated fields.
Question
Fill in the field types for the following sample record from a database:
| Field Name | Sample Data | Field Type |
| Forename | Ann | ? |
| Surname | Other | ? |
| Home town | Portree | ? |
| Contract start date | 24/12/2019 | ? |
| Height | 1.68 | ? |
| Time of inspection | 08:45 | ? |
| ID badge number | 345245 | ? |
| Field Name | Forename |
|---|---|
| Sample Data | Ann |
| Field Type | ? |
| Field Name | Surname |
|---|---|
| Sample Data | Other |
| Field Type | ? |
| Field Name | Home town |
|---|---|
| Sample Data | Portree |
| Field Type | ? |
| Field Name | Contract start date |
|---|---|
| Sample Data | 24/12/2019 |
| Field Type | ? |
| Field Name | Height |
|---|---|
| Sample Data | 1.68 |
| Field Type | ? |
| Field Name | Time of inspection |
|---|---|
| Sample Data | 08:45 |
| Field Type | ? |
| Field Name | ID badge number |
|---|---|
| Sample Data | 345245 |
| Field Type | ? |
| Field Name | Sample Data | Field Type |
| Forename | Usain | Text |
| Surname | Bolt | Text |
| Home town | Kingston | Text |
| Contract start date | 24/12/2015 | Date |
| Height | 1.97 | Number |
| Time of inspection | 08:45 | Time |
| ID badge number | 345245 | Number |
| Field Name | Forename |
|---|---|
| Sample Data | Usain |
| Field Type | Text |
| Field Name | Surname |
|---|---|
| Sample Data | Bolt |
| Field Type | Text |
| Field Name | Home town |
|---|---|
| Sample Data | Kingston |
| Field Type | Text |
| Field Name | Contract start date |
|---|---|
| Sample Data | 24/12/2015 |
| Field Type | Date |
| Field Name | Height |
|---|---|
| Sample Data | 1.97 |
| Field Type | Number |
| Field Name | Time of inspection |
|---|---|
| Sample Data | 08:45 |
| Field Type | Time |
| Field Name | ID badge number |
|---|---|
| Sample Data | 345245 |
| Field Type | Number |