Consider the following relation R(AB) A is primary key S(CB) C is primary key,…

Consider the following relation

R(AB) A is primary key

S(CB) C is primary key, attribute B of a relation R is foreign key reference to S and no NULL values in both relation and both R and S has more than 2 records. Which of the following is false?

Attempted by 21 students.

Show answer & explanation

Key constraint: Because attribute B in R is a foreign key referencing the primary key C in S and there are no NULL values, every value of B in R must appear as a value of C in S. In symbols: π_B(R) ⊆ π_C(S).

  • Consequently, π_B(R) − π_C(S) is always empty because there are no B values in R that are not also C values in S.

  • The difference π_C(S) − π_B(R) may be non-empty because S can contain primary key values that are never referenced by any row in R.

  • For the equijoin on R.B = S.C, projecting B from the join yields values that come from R and match C in S, so π_B(R ⋈_{R.B = S.C} S) ⊆ π_C(S); hence π_B(R ⋈_{R.B = S.C} S) − π_C(S) is always empty.

  • For the non-equi join R.B ≠ S.C, although the join pairs each R row with S rows having different C values, every B value that appears in the joined result still originates from R. Because π_B(R) ⊆ π_C(S), those B values are still values of C in S. Therefore π_B(R ⋈_{R.B ≠ S.C} S) − π_C(S) is also empty, so any claim that it may be non-empty is incorrect.

Conclusion: The only false statement is the one asserting that the set difference after the inequality join, π_B(R ⋈_{R.B ≠ S.C} S) − π_C(S), may be non-empty. All other stated differences are correctly described.

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…