Bird
0
0

Find the issue in this self join query:

medium📝 Debug Q7 of 15
SQL - INNER JOIN
Find the issue in this self join query:

SELECT e1.name, e2.name FROM employees e1, employees e2 WHERE e1.manager_id = e2.id;
AUsing comma join instead of explicit JOIN
BMissing explicit JOIN keyword
CNo aliasing of tables
DIncorrect join condition
Step-by-Step Solution
Solution:
  1. Step 1: Identify join style used

    The query uses comma-separated tables with WHERE clause, which is an old-style join.
  2. Step 2: Recognize best practice

    Explicit JOIN syntax is preferred for clarity and maintainability.
  3. Final Answer:

    Using comma join instead of explicit JOIN -> Option A
  4. Quick Check:

    Use explicit JOIN, not comma join [OK]
Quick Trick: Prefer explicit JOIN over comma joins [OK]
Common Mistakes:
MISTAKES
  • Using old comma join syntax
  • Not aliasing tables
  • Wrong join condition

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes