Skip to content
Official PYQ · 2012

GATE CS 2012 Q43 — Relational Model: Relational Algebra

Explain with AI

Suppose R1(A‾,B)R_{1} (\underline{A}, B) and R2(C‾,D)R_{2} (\underline{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
View worked solution

Answer: A

By definition, a referential integrity constraint ensures that every value of a foreign key in a referencing relation must exist in the primary key of the referenced relation.

Here, BB is a foreign key in R1R_1 that refers to the primary key CC in R2R_2. Therefore, every value of BB present in the instance r1r_1 must also be present in the column CC of the instance r2r_2.

In terms of relational algebra, this subset relationship is expressed as:

∏B(r1)⊆∏C(r2)\prod_{B}(r_{1}) \subseteq \prod_{C}(r_{2})

Using set theory, if X⊆YX \subseteq Y, then the set difference X−YX - Y is empty (X−Y=∅X - Y = \varnothing). Substituting our projections:

∏B(r1)−∏C(r2)=∅\prod_{B}(r_{1}) - \prod_{C}(r_{2}) = \varnothing

Hence, Option A is always true.

Analysis of other options:

  • Option B: ∏C(r2)−∏B(r1)=∅\prod_{C}(r_{2}) - \prod_{B}(r_{1}) = \varnothing is only true if every primary key value in r2r_2 is referenced by some tuple in r1r_1. This is not mandatory.
  • Option C: ∏B(r1)=∏C(r2)\prod_{B}(r_{1}) = \prod_{C}(r_{2}) is a special case of Option B and is not always true.
  • Option D: ∏B(r1)−∏C(r2)≠∅\prod_{B}(r_{1}) - \prod_{C}(r_{2}) \neq \varnothing represents a violation of referential integrity (where a foreign key value exists in r1r_1 but not in r2r_2).

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Relational Model: Relational Algebra questions