Bird
0
0

What does the SQL UNION operator do when combining results from two SELECT queries?

easy📝 Conceptual Q11 of 15
SQL - Set Operations
What does the SQL UNION operator do when combining results from two SELECT queries?
ACombines rows but keeps all duplicates
BCombines rows from both queries and removes duplicate rows
CJoins tables based on a common column
DFilters rows based on a condition
Step-by-Step Solution
Solution:
  1. Step 1: Understand UNION behavior

    The UNION operator combines rows from two or more SELECT queries into a single result set.
  2. Step 2: Check duplicate handling

    By default, UNION removes duplicate rows to ensure unique results.
  3. Final Answer:

    Combines rows from both queries and removes duplicate rows -> Option B
  4. Quick Check:

    UNION removes duplicates = A [OK]
Quick Trick: UNION removes duplicates by default, unlike UNION ALL [OK]
Common Mistakes:
MISTAKES
  • Confusing UNION with UNION ALL
  • Thinking UNION joins tables by columns
  • Assuming UNION filters rows

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes