Bird
0
0

How can you combine two SELECT queries in SQL to include all rows from both queries, including duplicates?

hard📝 Application Q9 of 15
SQL - Set Operations
How can you combine two SELECT queries in SQL to include all rows from both queries, including duplicates?
AUse UNION to combine the queries
BUse INTERSECT to combine the queries
CUse UNION ALL to combine the queries
DUse EXCEPT to combine the queries
Step-by-Step Solution
Solution:
  1. Step 1: Understand set operations

    UNION removes duplicates, UNION ALL keeps duplicates.
  2. Step 2: Identify correct operation

    To keep all rows including duplicates, UNION ALL is used.
  3. Final Answer:

    Use UNION ALL to combine the queries -> Option C
  4. Quick Check:

    UNION ALL preserves duplicates, unlike UNION [OK]
Quick Trick: UNION ALL keeps duplicates, UNION removes them [OK]
Common Mistakes:
MISTAKES
  • Using UNION instead of UNION ALL
  • Confusing INTERSECT with UNION ALL
  • Using EXCEPT which excludes rows

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes