CS FundamentalsModerateGATE CS · DBMS

R(A, B) = {(1, 2), (1, 4), (2, 4), (4, 1), (4, 2)} and S(B, C) = {(1, 6), (3, 5), (3, 7), (4, 6), (4, 7)}. How many tuples are in π_A(R ⋈ S) and in R ⋈ S respectively (set semantics)?

  1. A. 5 and 5
  2. B. 3 and 25
  3. C. 3 and 5
  4. D. 3 and 6

Correct answer: C. 3 and 5

R ⋈ S pairs each R tuple with every S tuple having the same B: 5 tuples. Projecting on A removes duplicates, leaving {1, 2, 4}.

More DBMS and SQL questions

Exams that ask this topic