Multiple choice technology databases

UNION vs. UNION ALL

  1. UNION only selects distinct values, UNION ALL selects all values (excluding ?duplicates)?

  2. UNION ALL only selects distinct values, UNION selects all values (including ?duplicates)?

  3. UNION only selects distinct values, UNION ALL selects all values (including ?duplicates)?

  4. UNION ALL only selects distinct values, UNION selects all values (excluding ?duplicates)?

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

UNION removes duplicate rows from the combined result set, while UNION ALL keeps all rows including duplicates. UNION ALL is faster because it skips the duplicate elimination step.