Bird
0
0

Identify the error in this SQL query using INNER JOIN with aliases:

medium📝 Debug Q14 of 15
SQL - INNER JOIN
Identify the error in this SQL query using INNER JOIN with aliases:
SELECT e.name, d.department FROM employees e INNER JOIN departments d ON e.dept_id = d.idd;
AAlias 'e' is not defined.
BMissing AS keyword for aliases.
CColumn 'idd' does not exist in departments table.
DINNER JOIN should be LEFT JOIN.
Step-by-Step Solution
Solution:
  1. Step 1: Check alias definitions

    Aliases 'e' and 'd' are correctly defined for employees and departments.
  2. Step 2: Verify join condition columns

    Column 'idd' in departments does not exist; likely a typo for 'id'.
  3. Final Answer:

    Column 'idd' does not exist in departments table. -> Option C
  4. Quick Check:

    Incorrect column name in ON clause causes error [OK]
Quick Trick: Check column names in ON clause carefully [OK]
Common Mistakes:
MISTAKES
  • Assuming missing AS keyword causes error
  • Confusing alias definition errors
  • Changing join type unnecessarily

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes