Bird
0
0

Identify the error in this SQL query:

medium📝 Debug Q6 of 15
SQL - INNER JOIN
Identify the error in this SQL query:
SELECT a.name, b.salary FROM Employees a JOIN Salaries b WHERE a.id = b.emp_id;
AUsing alias names incorrectly
BMissing ON keyword before join condition
CSELECT clause syntax is wrong
DJOIN cannot be used with WHERE clause
Step-by-Step Solution
Solution:
  1. Step 1: Check JOIN syntax

    JOIN requires ON keyword to specify the join condition, not WHERE.
  2. Step 2: Identify the error

    The condition 'a.id = b.emp_id' should be after ON, not in WHERE.
  3. Final Answer:

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

    JOIN condition needs ON, not WHERE [OK]
Quick Trick: Use ON for JOIN conditions, not WHERE [OK]
Common Mistakes:
MISTAKES
  • Placing join condition in WHERE instead of ON
  • Confusing alias usage with syntax errors

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes