Difficulty: Easy
Correct Answer: Valid (this is a referential integrity constraint/foreign key)
Explanation:
Introduction / Context: Understanding constraint types is essential for relational integrity. The statement "SALE.CNumber must exist in CUSTOMER.CNumber" specifies a rule connecting values across two tables. Determining the correct constraint type helps ensure correctness and efficient enforcement by the DBMS.
Given Data / Assumptions:
Concept / Approach: A referential integrity constraint (foreign key) ensures that each non-null value in a referencing column (SALE.CNumber) matches an existing value in the referenced column (CUSTOMER.CNumber). This preserves parent–child relationships and prevents orphan records. The DBMS enforces the rule on INSERT/UPDATE and, with defined actions, on DELETE/UPDATE in the parent.
Step-by-Step Solution:
Declare CUSTOMER.CNumber as a primary or unique key.Declare a foreign key on SALE(CNumber) referencing CUSTOMER(CNumber).Optionally specify ON DELETE/UPDATE actions (RESTRICT, CASCADE, SET NULL/DEFAULT).Verify that inserts into SALE require a matching CUSTOMER row.Verification / Alternative check: Attempt to insert SALE(CNumber) = 999 when no CUSTOMER row has CNumber = 999; the DBMS should reject the statement due to the foreign key violation.
Why Other Options Are Wrong:
Common Pitfalls: Forgetting to index the referencing column for performance; neglecting ON DELETE/UPDATE actions that match business rules; using triggers instead of declarative constraints unnecessarily.
Final Answer: Valid (this is a referential integrity constraint/foreign key)
Discussion & Comments