Suppose R1(A, B) and R2(C, D) are two relation schemas. Let r1 and r2 be the…
2012
Suppose R1(A, B) and R2(C, D) are two relation schemas. Let r1 and r2 be the corresponding relation instances. B is a foreign key that refers to C in R2. If data in r1 and r2 satisfy referential integrity constraints, which of the following is ALWAYS TRUE?
- A.
\(\prod_{B}(r_{1})- \prod _{C}(r_{2})= \varnothing\) - B.
\(\prod_{C}(r_{2})- \prod _{B}(r_{1})= \varnothing\) - C.
\(\prod_{B}(r_{1}) = \prod _{C}(r_{2})\) - D.
\(\prod_{B}(r_{1}) - \prod _{C}(r_{2}) \neq \varnothing\)
Attempted by 280 students.
Show answer & explanation
Correct answer: A
Key idea: A foreign key from attribute B in r1 to attribute C in r2 means every (non-NULL) value appearing in B of r1 must also appear among the values of C in r2.
Therefore, the projection of B over r1 is a subset of the projection of C over r2: ∏_B(r1) ⊆ ∏_C(r2).
From this subset relationship it follows that the difference ∏_B(r1) - ∏_C(r2) must be the empty set.
Note: If NULL values are permitted for the foreign key B, the referential constraint applies to non-NULL B values; the statement above is understood in that standard sense.
A video solution is available for this question — log in and enroll to watch it.