Difficulty: Medium
Correct Answer: either the parent table or the child table.
Explanation:
Introduction / Context:Unlike one-to-many relationships, a one-to-one (1:1) relationship offers flexibility in where you place the foreign key. The design choice depends on optionality, access patterns, and normalization goals.
Given Data / Assumptions:
Concept / Approach:In a 1:1, the foreign key can reside in either table. A common approach is to place the FK in the table that is optional (the “child” in an identifying sense), possibly also making it the primary key (PK = FK) to enforce strict 1:1. If both sides are mandatory, choose the table that best fits access and lifecycle semantics.
Step-by-Step Solution:
Determine optionality: which side can exist without the other?Place the FK in the optional side and consider PK=FK to enforce true 1:1.Add UNIQUE constraints if necessary to prevent multiple matches.Verification / Alternative check:Attempt to insert multiple rows referencing the same counterpart; UNIQUE/PK=FK should prevent violations, confirming a true 1:1.
Why Other Options Are Wrong:
Common Pitfalls:Accidentally creating a 1:N by not enforcing uniqueness on the foreign key. Always ensure FK has a UNIQUE or PK constraint to maintain 1:1.
Final Answer:either the parent table or the child table.
Discussion & Comments