Bird
0
0

Identify the error in this query that aims to preserve all rows from Employees while joining Departments:

medium📝 Debug Q6 of 15
SQL - LEFT and RIGHT JOIN
Identify the error in this query that aims to preserve all rows from Employees while joining Departments:

SELECT Employees.name, Departments.name FROM Employees LEFT JOIN Departments WHERE Employees.dept_id = Departments.id;
AUsing WHERE instead of ON causes syntax error
BLEFT JOIN should be INNER JOIN
CMissing ON clause before WHERE
DNo error, query is correct
Step-by-Step Solution
Solution:
  1. Step 1: Check JOIN syntax

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

    Query uses WHERE instead of ON, so join condition is missing and syntax is invalid.
  3. Final Answer:

    Missing ON clause before WHERE -> Option C
  4. Quick Check:

    LEFT JOIN needs ON clause, not WHERE for join condition [OK]
Quick Trick: Use ON for join condition, WHERE filters after join [OK]
Common Mistakes:
MISTAKES
  • Placing join condition in WHERE instead of ON
  • Confusing WHERE and ON clauses
  • Assuming WHERE works as join condition

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes