Bird
0
0

Find the error in this nested subquery:

medium📝 Debug Q7 of 15
SQL - Subqueries
Find the error in this nested subquery:
SELECT emp_id FROM Employees WHERE dept_id IN (SELECT dept_id FROM Departments WHERE name = 'Marketing' OR);
AMissing closing parenthesis in subquery
BUsing IN instead of = for subquery
CSyntax error due to trailing OR in subquery
DIncorrect column name 'emp_id'
Step-by-Step Solution
Solution:
  1. Step 1: Inspect subquery syntax

    The subquery ends with 'OR' without a condition, causing syntax error.
  2. Step 2: Confirm error type

    Trailing logical operators without conditions are invalid in SQL.
  3. Final Answer:

    Syntax error due to trailing OR in subquery -> Option C
  4. Quick Check:

    Trailing OR causes syntax error [OK]
Quick Trick: Avoid dangling logical operators in queries [OK]
Common Mistakes:
MISTAKES
  • Leaving incomplete conditions
  • Misplacing parentheses
  • Confusing IN and = usage

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes