Fields, records and files
| Term | Meaning | Example |
|---|---|---|
| Field | One item of data | Surname |
| Record | All the fields about one person or thing | One student's details |
| File | A collection of related records | Every student in the school |
| Key field | A field that identifies each record uniquely | StudentID |
Designing a file means deciding, for each field:
- its name, which should describe the data
- its data type: text (string), integer, real, date, Boolean
- its length (for text fields) or size in bytes
- any validation rules
- which field is the key and the order the records are kept in
Choose data types carefully. A phone number is stored as text, not an integer: it has a leading 0, may contain spaces, and is never used in calculations. Dates are stored as a date type so they can be sorted and compared properly.