Difficulty: Easy
Correct Answer: Incorrect
Explanation:
Introduction / Context: Foreign keys enforce referential integrity (RI) by constraining values in the child table to those existing in the parent. The statement suggests that merely having a column intended to reference another table creates a “casual relationship” without a formal constraint. This probes understanding of logical design versus enforced integrity.
Given Data / Assumptions:
Concept / Approach: Without an explicit FOREIGN KEY constraint, the database engine will not enforce RI. The link is at best conventional or “soft,” relying on application discipline. Such conventions are brittle: orphan rows can appear, deletes in the parent can leave dangling references, and updates may violate intended links. Therefore, the statement that a relationship has been “created” is incorrect; only a column has been created. A relationship, in the relational sense, requires an enforced constraint or a join condition used in queries—preferably both.
Step-by-Step Solution:
Check presence of the constraint: absent.Assess enforcement: none by the DBMS; integrity depends on external logic.Determine existence of relationship: not guaranteed; therefore the claim is incorrect.Conclude that you must define FOREIGN KEY ... REFERENCES ... to establish RI.Verification / Alternative check: Attempt to insert a child row with a non-existent parent key; without the constraint, the DBMS accepts it, proving the “relationship” is not enforced.
Why Other Options Are Wrong:
Common Pitfalls: Relying on naming conventions instead of constraints; believing ORMs automatically enforce RI at the server without explicit DDL.
Final Answer: Incorrect
Discussion & Comments