Referential integrity nuance — evaluate the claim:\n“When a foreign-key column exists without an explicit FOREIGN KEY constraint, a ‘casual relationship’ between the two tables has been created.”\nChoose whether this is correct or incorrect.

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:

  • A column named, for example, customer_id exists in an orders table.
  • No FOREIGN KEY constraint has been defined.
  • Application code may still treat the column as a reference by convention.


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:

  • Matching names or isolation levels do not create constraints.
  • “Indeterminate” is wrong—behavior is clear and testable.


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

No comments yet. Be the first to comment!
Join Discussion