Bird
0
0

What does the SQL statement UNION ALL do when combining results from two queries?

easy📝 Conceptual Q11 of 15
SQL - Set Operations
What does the SQL statement UNION ALL do when combining results from two queries?
AIt combines rows but removes duplicates.
BIt combines all rows from both queries including duplicates.
CIt only returns rows that appear in both queries.
DIt returns rows only from the first query.
Step-by-Step Solution
Solution:
  1. Step 1: Understand UNION ALL behavior

    UNION ALL combines results from two queries and keeps all rows, including duplicates.
  2. Step 2: Compare with UNION

    Unlike UNION, UNION ALL does not remove duplicate rows.
  3. Final Answer:

    It combines all rows from both queries including duplicates. -> Option B
  4. Quick Check:

    UNION ALL keeps duplicates = A [OK]
Quick Trick: UNION ALL keeps duplicates, UNION removes them [OK]
Common Mistakes:
MISTAKES
  • Confusing UNION ALL with UNION
  • Thinking duplicates are removed
  • Assuming it returns only unique rows

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes