Difficulty: Easy
Correct Answer: Correct
Explanation:
Introduction / Context:
Referential integrity (RI) ensures that when a foreign key (FK) references a parent table, the referenced parent row exists. Designers often ask whether NULLs are compatible with RI. Understanding how NULL interacts with FKs is fundamental for optional relationships, historical snapshots, and staged data loads.
Given Data / Assumptions:
Concept / Approach:
A NULL in a foreign key column indicates “unknown” or “not applicable.” In most DBMS products, a NULL FK neither passes nor fails a lookup; it is excluded from the RI check because there is no value to verify against the parent. Therefore, an FK may be NULL without violating RI, provided business rules allow it and the column is not declared NOT NULL. This is how optional relationships are modeled: the FK is nullable and, when present, must match an existing parent key value.
Step-by-Step Solution:
Verification / Alternative check:
Create a child row with a NULL FK in a test schema; observe that inserts succeed under RI, while non-NULL values that lack matching parents are rejected.
Why Other Options Are Wrong:
Common Pitfalls:
Confusing business-mandated non-nullability with RI itself; assuming NULL equals a special key value, which it does not.
Final Answer:
Correct
Discussion & Comments