Bird
0
0

Find the issue in this query:

medium📝 Debug Q7 of 15
SQL - Subqueries
Find the issue in this query:
SELECT * FROM sales WHERE product_id IN SELECT product_id FROM products WHERE price > 100;
AUsing '*' in SELECT is invalid
BMissing parentheses around the subquery
CSubquery returns no rows
DIncorrect use of IN keyword
Step-by-Step Solution
Solution:
  1. Step 1: Check subquery syntax

    The subquery after IN must be enclosed in parentheses.
  2. Step 2: Identify missing parentheses

    The query misses parentheses around the subquery, causing syntax error.
  3. Final Answer:

    Missing parentheses around the subquery -> Option B
  4. Quick Check:

    Subquery in WHERE with IN needs parentheses [OK]
Quick Trick: Always put subquery in parentheses after IN [OK]
Common Mistakes:
MISTAKES
  • Omitting parentheses around subquery
  • Misplacing IN keyword
  • Assuming '*' is invalid in SELECT

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes