Consider the relations R (A, B), S (A, B, C), and T (A, B, C). Assume that all…

Consider the relations R (A, B), S (A, B, C), and T (A, B, C). Assume that all attributes are integer’s types and make no assumptions about keys. Which of the following expressions are equivalent to each other? 


Answer: C. 1 and 2 onlyAnswer: Expressions 1 and 2 are equivalent; expression 3 is not. Reason (why 1 and 2 are equivalent): Selection distributes over set difference: σ_{B<10}(S) −…

  1. A.

    2 and 3 only

  2. B.

    1 and 3 only

  3. C.

    1 and 2 only

  4. D.

    All the above 

Attempted by 56 students.

Show answer & explanation

Correct answer: C

Answer: Expressions 1 and 2 are equivalent; expression 3 is not.

Reason (why 1 and 2 are equivalent):

  • Selection distributes over set difference: σ_{B<10}(S) − σ_{B<10}(T) = σ_{B<10}(S − T).

  • Expression 2 becomes π_{A,C}( R ⋈ σ_{B<10}(S − T) ).

  • A join between R(A,B) and σ_{B<10}(S − T) matches on attribute B; any joined tuple must have the same B value and that B must satisfy B<10. Therefore R ⋈ σ_{B<10}(S − T) = σ_{B<10}(R) ⋈ (S − T).

  • Applying π_{A,C} to both sides yields the same result, so expressions 1 and 2 are equivalent.

Why expression 3 is not equivalent:

  • Expression 3 projects R to remove attribute B before the join (π_A(R)), so the join no longer enforces matching on B. That changes the join semantics and can produce different pairs (it effectively joins only on A).

  • Counterexample (small concrete dataset):

  • - Let R = {(A=1,B=20)} (no B<10 tuples).

  • - Let S = {(A=1,B=5,C=100)} and T = ∅.

  • Then expression 1 (and 2) is empty because σ_{B<10}(R) = ∅, so there are no matches. Expression 3, however, has π_A(R) = {(A=1)}; joining with S produces (A=1,C=100), so expression 3 yields a nonempty result. Thus expression 3 differs.

Conclusion: Expressions 1 and 2 are equivalent; expression 3 is not. (So the correct choice is the one that selects "1 and 2 only".)

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…