Bird
0
0

Identify the error in this query:

medium📝 Debug Q6 of 15
SQL - Subqueries
Identify the error in this query:
SELECT name FROM Employees WHERE EXISTS SELECT 1 FROM Projects WHERE employee_id = Employees.id;
AIncorrect table alias usage
BMissing parentheses around the subquery after EXISTS
CEXISTS cannot be used in SELECT clause
DMissing WHERE clause in subquery
Step-by-Step Solution
Solution:
  1. Step 1: Check EXISTS syntax

    The EXISTS operator 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 B
  4. Quick Check:

    EXISTS needs parentheses around subquery [OK]
Quick Trick: Always put subquery in parentheses after EXISTS [OK]
Common Mistakes:
MISTAKES
  • Omitting parentheses around subquery
  • Using EXISTS in SELECT clause
  • Incorrect alias references

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes