Difficulty: Easy
Correct Answer: An attribute that serves as the primary key of another relation
Explanation:
Introduction / Context:
Foreign keys are crucial for enforcing referential integrity between related tables. They ensure that every child row points to a valid parent row, which preserves consistency and prevents orphaned records in relational databases.
Given Data / Assumptions:
Concept / Approach:
A foreign key is an attribute (or set of attributes) in the child relation whose values must match existing values of the parent relation’s primary key. This constraint enforces valid references and is central to normalized design.
Step-by-Step Solution:
Verification / Alternative check:
Try inserting a child row with a non-existent parent key; the database should reject it. Deleting a parent may require cascading or restriction to preserve integrity.
Why Other Options Are Wrong:
Any attribute: too vague; not all attributes are foreign keys.
Same as primary key: different concepts; one enforces identity, the other enforces reference.
Serves no purpose: incorrect; foreign keys are essential for data integrity.
Common Pitfalls:
Mismatched data types between PK and FK, missing indexes on foreign keys, and failing to handle deletes/updates appropriately.
Final Answer:
An attribute that serves as the primary key of another relation
Discussion & Comments