Bird
0
0

Find the error in this query:

medium📝 Debug Q7 of 15
PostgreSQL - Set Operations and Advanced Queries
Find the error in this query:
SELECT id FROM table1 INTERSECT table2;
AINTERSECT cannot be used with tables directly
BTable names cannot be used in INTERSECT
CMissing semicolon at end
DMissing SELECT statement for second query
Step-by-Step Solution
Solution:
  1. Step 1: Check syntax for INTERSECT

    INTERSECT requires two SELECT statements, not just table names.
  2. Step 2: Identify missing SELECT

    The second query should be SELECT id FROM table2.
  3. Final Answer:

    Missing SELECT statement for second query -> Option D
  4. Quick Check:

    INTERSECT needs two SELECTs [OK]
Quick Trick: Use SELECT in both queries with INTERSECT [OK]
Common Mistakes:
  • Using table names without SELECT
  • Assuming INTERSECT works like JOIN
  • Omitting FROM clause

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes