Bird
0
0

Identify the error in this SQL query:

medium📝 Debug Q14 of 15
SQL - INNER JOIN
Identify the error in this SQL query:
SELECT e.name, d.dept_name FROM Employees e INNER JOIN Departments d ON e.dept_id == d.dept_id;
AThe join condition uses '==' instead of '='.
BUsing alias names for tables is not allowed.
CMissing WHERE clause for filtering.
DINNER JOIN requires USING instead of ON.
Step-by-Step Solution
Solution:
  1. Step 1: Check join condition syntax

    SQL uses a single equals sign (=) for comparison, not double equals (==).
  2. Step 2: Verify other parts of the query

    Aliases e and d are valid. WHERE clause is optional. INNER JOIN can use ON.
  3. Final Answer:

    The join condition uses '==' instead of '='. -> Option A
  4. Quick Check:

    Use = for join conditions, not == [OK]
Quick Trick: Use single = in ON clause, not double == [OK]
Common Mistakes:
MISTAKES
  • Using == instead of = in join condition
  • Thinking aliases are disallowed
  • Confusing ON with WHERE clause necessity

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes