CS FundamentalsHardGATE CS · Amazon/Microsoft SDE MCQ

R(a) = {1, 2, 3} and S(a) = {2, 3, 3, 4} (S is a bag). How many rows does SELECT * FROM R FULL OUTER JOIN S ON R.a = S.a return? (Checked in SQLite 3.39+, which supports FULL OUTER JOIN.)

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

Correct answer: C. 5

Matches: 2 pairs with one 2, and 3 pairs with both 3s, giving 3 rows. Unmatched R row 1 and unmatched S row 4 add one NULL-padded row each: 5. Forgetting the duplicate 3 gives 4.

More DBMS and SQL questions

Exams that ask this topic