Bird
0
0

You wrote this SQL query:

medium📝 Debug Q14 of 15
SQL - Set Operations
You wrote this SQL query:
SELECT * FROM table1 UNION table2;
What is the error and how to fix it?
AMissing SELECT before table2; fix by adding SELECT * FROM table2
BUNION cannot be used with tables; use JOIN instead
CUNION requires parentheses around queries
DNo error; query runs fine
Step-by-Step Solution
Solution:
  1. Step 1: Identify syntax error in UNION usage

    UNION requires two complete SELECT statements, but second query lacks SELECT.
  2. Step 2: Correct the query syntax

    Add SELECT * FROM before table2 to fix the error.
  3. Final Answer:

    Missing SELECT before table2; fix by adding SELECT * FROM table2 -> Option A
  4. Quick Check:

    UNION needs two SELECTs [OK]
Quick Trick: UNION needs two full SELECT queries [OK]
Common Mistakes:
MISTAKES
  • Omitting SELECT in second query
  • Using UNION with tables directly
  • Adding unnecessary parentheses

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes