Bird
0
0

Identify the error in this SQL query that uses a JOIN:

medium📝 Debug Q14 of 15
SQL - Subqueries
Identify the error in this SQL query that uses a JOIN:
SELECT c.name, o.amount FROM customers c JOIN orders o WHERE c.id = o.customer_id;
AIncorrect table aliases used.
BUsing WHERE instead of HAVING for condition.
CMissing ON keyword before join condition.
DNo error; query is correct.
Step-by-Step Solution
Solution:
  1. Step 1: Review JOIN syntax

    JOIN requires an ON clause to specify join condition, not WHERE.
  2. Step 2: Check the query

    The query uses WHERE for join condition, which is incorrect syntax for explicit JOIN.
  3. Final Answer:

    Missing ON keyword before join condition. -> Option C
  4. Quick Check:

    JOIN needs ON, not WHERE [OK]
Quick Trick: JOIN must have ON clause for conditions [OK]
Common Mistakes:
MISTAKES
  • Using WHERE instead of ON for JOIN
  • Confusing HAVING with WHERE
  • Assuming aliases cause error

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes