Define the terms primary key and foreign key, and outline one reason for using a foreign key in a relational database. [3]
- Primary key: a field (or combination of fields) whose value uniquely identifies each record in a table (must say 'unique' or 'uniquely')(1)
- Foreign key: a field in one table that refers to / matches the primary key of another table (accept 'is the primary key of another table')(1)
- Reason: it creates a relationship / link between the two tables; accept: enforces referential integrity (a record cannot refer to a record that does not exist); accept: data is stored once and referenced, reducing redundancy(1)
- Answer: A primary key uniquely identifies each record; a foreign key is a field that refers to the primary key of another table, used to link the tables (and enforce referential integrity).
- Examiner tip: Say 'uniquely' for the primary key and 'primary key of another table' for the foreign key.