Bird
0
0

Identify the error in this query:

medium📝 Debug Q6 of 15
PostgreSQL - Joins in PostgreSQL
Identify the error in this query:
SELECT a.id, b.name FROM tableA a INNER JOIN tableB b ON a.id == b.a_id;
AINNER JOIN requires USING clause, not ON
BMissing table alias for tableB
CSELECT clause must include all columns from both tables
DUsing '==' instead of '=' in ON clause
Step-by-Step Solution
Solution:
  1. Step 1: Check ON clause syntax

    SQL uses single '=' for comparison, '==' is invalid syntax.
  2. Step 2: Verify other parts

    Table aliases are correctly used, INNER JOIN supports ON clause, SELECT can specify columns.
  3. Final Answer:

    Using '==' instead of '=' in ON clause -> Option D
  4. Quick Check:

    ON clause uses '=' not '==' [OK]
Quick Trick: Use single '=' in ON clause for joins [OK]
Common Mistakes:
  • Using '==' instead of '=' in join condition
  • Confusing USING and ON clauses
  • Assuming SELECT must include all columns

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes