CS FundamentalsHardGATE CS · Product placement

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

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

Correct answer: A. 4 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, 3, 4}.

More DBMS and SQL questions

Exams that ask this topic