CS FundamentalsVery hardGATE CS

Which relational-algebra equivalence is NOT valid in general?

  1. A. σ_p(R − S) = σ_p(R) − S (selection over difference)
  2. B. σ_p(R ∪ S) = σ_p(R) ∪ σ_p(S) (selection over union)
  3. C. π_A(R − S) = π_A(R) − π_A(S) (projection over difference)
  4. D. π_A(R ∪ S) = π_A(R) ∪ π_A(S) (projection over union)

Correct answer: C. π_A(R − S) = π_A(R) − π_A(S) (projection over difference)

Projection does not distribute over difference: with R = {(1, x)} and S = {(1, y)}, π_A(R − S) = {1} but π_A(R) − π_A(S) is empty. Selection does distribute over difference and union, and projection over union.

More DBMS and SQL questions

Exams that ask this topic