Question

Suppose R1(A,B)R_1(A, B) and R2(C,D)R_2(C, D) are two relation schemas. Let r1r_1 and r2r_2 be the corresponding relation instances. BB is a foreign key that refers to CC in R2R_2. If data in r1r_1 and r2r_2 satisfy referential integrity constraints, which of the following is ALWAYS TRUE?

Choose one option
Official answer and solution
Official answer
A
From
Official GATE 2012 answer key

Solution

Apply the relational definition of foreign keys and referential integrity constraints.

  1. Let BB in relation r1r_1 be a foreign key referencing primary key CC in relation r2r_2.

  2. The referential integrity constraint requires that for every tuple in r1r_1, the foreign key value in BB must either be NULL or match an existing value in attribute CC of r2r_2.

  3. In terms of relation instances (assuming non-null foreign key values as modeled in relational algebra):

ΠB(r1)⊆ΠC(r2)\Pi_B(r_1) \subseteq \Pi_C(r_2)
  1. In set algebra, set XX is a subset of set YY (X⊆YX \subseteq Y) if and only if the difference X−YX - Y is empty:
ΠB(r1)−ΠC(r2)=∅\Pi_B(r_1) - \Pi_C(r_2) = \emptyset
  1. Thus, statement (A) is ALWAYS TRUE.
Final answer

A

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2012 Computer Science and Information Technology (CS)
Question
43 of 65, printed as CS Q.43
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.