Ace the A Level Computer Science OCR 2025 – Code Your Way to Success!

Question: 1 / 400

What is a key function of a foreign key in a relational database?

To uniquely identify records within one table

To establish a relationship between two tables

A foreign key plays a crucial role in establishing relationships between two tables in a relational database. This functionality allows one table to reference the primary key of another table, which creates a link between them. Through this relationship, the foreign key ensures data integrity and enforces referential integrity, meaning that the data in the foreign key field must either match a primary key value in the referenced table or be null. This is fundamental in maintaining the logical connections between entities within a database, thereby facilitating complex queries and data management.

The other options do not accurately describe the function of a foreign key. For instance, while uniquely identifying records is a responsibility of a primary key, the foreign key's primary purpose is to link tables rather than serve this distinct function. Similarly, limiting the number of records is not a characteristic of foreign keys; rather, it relates to data constraints and how records are managed overall in a database. A temporary identifier does not match the function of a foreign key since its purpose is to maintain a persistent reference to another table's primary key, rather than serving as a short-term label for records.

Get further explanation with Examzify DeepDiveBeta

To limit the number of records

To serve as a temporary identifier

Next Question

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy