CS FundamentalsModerateGATE CS

A(x) holds 1, 2, 2, 3 and B(x) holds 2, 3, 3, 4. How many rows does SELECT x FROM A UNION SELECT x FROM B return?

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

Correct answer: A. 4

UNION removes duplicates, leaving the distinct values 1, 2, 3, 4. UNION ALL would give 8 rows.

More DBMS and SQL questions

Exams that ask this topic