Bird
0
0

Find the mistake in this query:

medium📝 Debug Q7 of 15
SQL - Set Operations
Find the mistake in this query:
SELECT name FROM table1 UNION SELECT name FROM table2 ORDER BY table1.name;
AUNION requires columns to be aliased
BORDER BY must come before UNION
CORDER BY cannot use table alias after UNION
DSELECT statements must have WHERE clause
Step-by-Step Solution
Solution:
  1. Step 1: Understand ORDER BY scope after UNION

    After UNION, the result is a combined set without table aliases.

  2. Step 2: Check ORDER BY usage

    ORDER BY cannot reference original table aliases; must use column names only.

  3. Final Answer:

    ORDER BY cannot use table alias after UNION -> Option C
  4. Quick Check:

    ORDER BY uses column names, not table aliases after UNION [OK]
Quick Trick: After UNION, ORDER BY uses column names only, no table aliases [OK]
Common Mistakes:
MISTAKES
  • Using table aliases in ORDER BY after UNION
  • Placing ORDER BY before UNION
  • Assuming WHERE clause is mandatory

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes