Bird
0
0

Identify the error in this query:

medium📝 Debug Q14 of 15
SQL - Subqueries
Identify the error in this query:
SELECT * FROM Employees e WHERE EXISTS SELECT * FROM Salaries s WHERE s.emp_id = e.id;
AEXISTS cannot be used in WHERE clause.
BUsing SELECT * inside EXISTS is not allowed.
CMissing parentheses around the subquery after EXISTS.
DThe alias 'e' is not defined.
Step-by-Step Solution
Solution:
  1. Step 1: Check EXISTS syntax

    EXISTS requires the subquery to be enclosed in parentheses.
  2. Step 2: Identify the missing parentheses

    The query lacks parentheses around the subquery after EXISTS, causing a syntax error.
  3. Final Answer:

    Missing parentheses around the subquery after EXISTS. -> Option C
  4. Quick Check:

    EXISTS (subquery) needs parentheses [OK]
Quick Trick: Always put parentheses around subquery after EXISTS [OK]
Common Mistakes:
MISTAKES
  • Omitting parentheses around subquery
  • Thinking SELECT * is invalid inside EXISTS
  • Misunderstanding alias usage

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes