Exam-style question
Try this first
Explain how primary keys and foreign keys can be used to relate two tables in a relational database. Include the purpose of each key.
Model answer
What a good answer should say
- A primary key uniquely identifies each record in its own table.
- A foreign key is an attribute in another table that refers to this primary key.
- The matching key values provide a link between the two tables, allowing related records to be associated.
Explanation
Why this works
The answer must distinguish the two roles. The primary key identifies records in its own table, while the foreign key creates the relationship by referring to that primary key in another table.
Common mistake
No common mistake is linked to this question yet.
