Bird
0
0

Identify the error in the following SQL statement:

medium📝 Debug Q6 of 15
SQL - Set Operations
Identify the error in the following SQL statement:
SELECT id FROM table1 UNION ALL SELECT FROM table2;
AMissing semicolon at the end
BUNION ALL cannot be used with SELECT
CMissing column name after second SELECT
DTable names must be the same
Step-by-Step Solution
Solution:
  1. Step 1: Check second SELECT syntax

    The second SELECT is missing the column name after SELECT.
  2. Step 2: Validate UNION ALL usage

    UNION ALL is valid with SELECT statements having matching columns.
  3. Final Answer:

    Missing column name after second SELECT -> Option C
  4. Quick Check:

    Syntax error = missing column name [OK]
Quick Trick: Each SELECT must specify columns before UNION ALL [OK]
Common Mistakes:
MISTAKES
  • Omitting column names in SELECT
  • Thinking UNION ALL needs same table names
  • Ignoring syntax errors

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes