Bird
0
0

Which of the following is the correct syntax to combine two SELECT queries using UNION?

easy📝 Syntax Q12 of 15
SQL - Set Operations
Which of the following is the correct syntax to combine two SELECT queries using UNION?
ASELECT col1 FROM table1 UNION ALL JOIN SELECT col1 FROM table2;
BSELECT col1 FROM table1 JOIN SELECT col1 FROM table2;
CSELECT col1 FROM table1 WHERE UNION SELECT col1 FROM table2;
DSELECT col1 FROM table1 UNION SELECT col1 FROM table2;
Step-by-Step Solution
Solution:
  1. Step 1: Review correct UNION syntax

    The correct syntax is to write two SELECT statements separated by the UNION keyword.
  2. Step 2: Identify invalid options

    Options B, C, and D misuse JOIN or WHERE with UNION, which is incorrect syntax.
  3. Final Answer:

    SELECT col1 FROM table1 UNION SELECT col1 FROM table2; -> Option D
  4. Quick Check:

    UNION syntax = SELECT ... UNION SELECT ... [OK]
Quick Trick: UNION joins SELECTs directly, no JOIN or WHERE needed [OK]
Common Mistakes:
MISTAKES
  • Using JOIN instead of UNION
  • Placing WHERE before UNION
  • Combining UNION ALL with JOIN incorrectly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes