Correct option is C
A Foreign Key is a field or set of fields in one table that refers to the Primary Key of another table. Its main purpose is to establish and maintain a relationship between two tables and ensure referential integrity in a relational database.
Foreign keys help prevent invalid data by ensuring that values in the foreign key column correspond to existing values in the referenced table.
Therefore, option (c) is correct.
Important Key Points:
- A Foreign Key creates a relationship between two database tables.
- It references the Primary Key of another table.
- Foreign keys help maintain referential integrity.
- A foreign key column may contain duplicate and sometimes NULL values unless restricted.
Knowledge Booster:
- (a) A foreign key uniquely identifies every record in a table: Incorrect because uniquely identifying records is the function of a Primary Key, not a foreign key.
- (b) A foreign key is primarily used to sort records in ascending order: Incorrect because sorting is performed using queries such as ORDER BY, not by foreign keys.
- (d) A foreign key must always contain only unique values: Incorrect because foreign key values can repeat in multiple rows to represent many-to-one relationships.
- (e) A foreign key cannot contain duplicate or NULL values: Incorrect because foreign keys can contain duplicate values and may also contain NULL values unless a constraint prevents them.