Creating relationships in the relational model: Which construct is used to relate rows across two tables (parent and child)?
-
Acomposite keys.
-
Bdeterminants.
-
Ccandidate keys.
-
Dforeign keys.
-
Esurrogate attributes only.
Answer
Correct Answer: foreign keys.
Explanation
Introduction / Context:Relational databases link tables through referential constraints, enabling normalized designs while preserving navigability across entities.
Given Data / Assumptions:
- A parent table has a primary (or candidate) key.
- A child table references that key to relate its rows.
- Standard SQL referential integrity rules apply.
Concept / Approach:A foreign key in the child table references the candidate/primary key in the parent table. This enforces referential integrity: each foreign key value must match an existing parent key or be null (subject to constraints).
Step-by-Step Solution:
Identify the parent’s identifying key (primary/candidate).Declare a foreign key in the child referencing the parent’s key.RDBMS enforces insert/update/delete rules to maintain integrity.Verification / Alternative check:SQL DDL (FOREIGN KEY ... REFERENCES ...) codifies this mechanism.
Why Other Options Are Wrong:Composite keys: Can be foreign or candidate keys but don’t by themselves create relationships. Determinants / candidate keys: Important internally; relationships are implemented via foreign keys.
Common Pitfalls:Confusing a parent’s primary key (identifier) with the child’s foreign key (reference); both are needed to form the link.
Final Answer:foreign keys.