Bird
0
0

Identify the error in this query:

medium📝 Debug Q6 of 15
PostgreSQL - Set Operations and Advanced Queries
Identify the error in this query:
SELECT id FROM table1 UNION ALL table2;
AMissing SELECT keyword before second table
BSyntax error: second SELECT query missing
CUNION ALL cannot be used with tables
DNo error, query is valid
Step-by-Step Solution
Solution:
  1. Step 1: Analyze UNION ALL syntax

    UNION ALL requires two SELECT queries separated by UNION ALL.
  2. Step 2: Check the query structure

    The second SELECT keyword is missing before table2, causing syntax error.
  3. Final Answer:

    Syntax error: second SELECT query missing -> Option B
  4. Quick Check:

    UNION ALL needs two SELECTs [OK]
Quick Trick: Always write SELECT before each query in UNION ALL [OK]
Common Mistakes:
  • Omitting second SELECT keyword
  • Trying to UNION ALL tables directly
  • Assuming UNION ALL works like JOIN

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes