CS FundamentalsModerateGATE CS (PYQ pattern)

R(A, B) and S(B) are relations. Which relational-algebra expression computes the division R ÷ S (the A-values that are paired in R with every B-value of S)?

  1. A. π_A(R) − π_A(R ⋈ S)
  2. B. π_A(R ⋈ S) − π_A((π_A(R) × S) ∩ R)
  3. C. π_A(R) − π_A((π_A(R) × S) − R)
  4. D. π_A(R) − π_A(R − (π_A(R) × S))

Correct answer: C. π_A(R) − π_A((π_A(R) × S) − R)

(π_A(R) × S) − R lists the (A, B) pairs that should exist but are missing; projecting on A gives the disqualified A-values, and subtracting them from π_A(R) leaves exactly the division result.

More DBMS and SQL questions

Exams that ask this topic