Bird
0
0

Given two tables:

medium📝 query result Q4 of 15
SQL - Set Operations
Given two tables:
Employees_A: {1, 2, 3}
Employees_B: {3, 4, 5}
What will be the result of SELECT id FROM Employees_A UNION SELECT id FROM Employees_B;?
A{1, 2, 3, 4, 5}
B{3}
C{1, 2, 3}
D{3, 4, 5}
Step-by-Step Solution
Solution:
  1. Step 1: Understand UNION behavior

    UNION combines all unique rows from both tables without duplicates.
  2. Step 2: Combine and remove duplicates

    Employees_A has 1,2,3 and Employees_B has 3,4,5. Combined unique set is 1,2,3,4,5.
  3. Final Answer:

    {1, 2, 3, 4, 5} -> Option A
  4. Quick Check:

    UNION result = all unique rows combined [OK]
Quick Trick: UNION merges unique rows from both queries [OK]
Common Mistakes:
MISTAKES
  • Expecting duplicates in UNION result
  • Confusing UNION with INTERSECT
  • Ignoring unique row behavior

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes