Bird
0
0

Find the mistake in this query:

medium📝 Debug Q7 of 15
SQL - INNER JOIN
Find the mistake in this query:
SELECT e.name, d.dept_name FROM Employees e INNER JOIN Departments d ON e.department_id = d.dept_id;
AINNER JOIN should be LEFT JOIN
BMissing table alias for Employees
CColumn name 'department_id' does not match 'dept_id'
DNo mistake, query is correct
Step-by-Step Solution
Solution:
  1. Step 1: Check join condition columns

    The query joins on e.department_id and d.dept_id, but these columns likely do not match because of different names.
  2. Step 2: Identify mismatch causing no join

    Joining on mismatched columns causes no matches or errors; correct column should be consistent.
  3. Final Answer:

    Column name 'department_id' does not match 'dept_id' -> Option C
  4. Quick Check:

    Join columns must match in name and meaning [OK]
Quick Trick: Join columns must have matching names and data [OK]
Common Mistakes:
MISTAKES
  • Using different column names in join condition
  • Assuming aliases fix column mismatches
  • Confusing INNER JOIN with LEFT JOIN

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes