- Records, fields and the key
A file is a collection of records; each record is made of fields, and one field is usually the key.
A file stores many records. Each record is made of fields — for example a customer record has the fields customerID, name, balance.
One field is special: the key field. Its value uniquely identifies the record (no two records share it) and it is the value used to order records or to calculate where to store them.
| Term | Meaning |
|---|---|
| Record | one complete entry (e.g. one customer) |
| Field | one item of data within a record (e.g. name) |
| Key field / record key | the field that uniquely identifies a record (e.g. customerID) |
The three file organisations below differ only in how the records are arranged, and that in turn decides how they can be accessed.
- File → records → fields.
- The key field uniquely identifies a record.
- The key is used to order records (sequential) or to compute an address (random).