Bird
0
0

Identify the error in this query:

medium📝 Debug Q14 of 15
PostgreSQL - Subqueries in PostgreSQL
Identify the error in this query:
SELECT name FROM employees WHERE salary > ANY SELECT bonus FROM bonuses;
AUsing ANY instead of ALL causes syntax error.
BIncorrect use of > operator with ANY.
CSubquery should be in FROM clause, not WHERE.
DMissing parentheses around the subquery after ANY.
Step-by-Step Solution
Solution:
  1. Step 1: Check ANY syntax

    ANY must be followed by a subquery enclosed in parentheses.
  2. Step 2: Identify missing parentheses

    The query lacks parentheses around SELECT bonus FROM bonuses after ANY.
  3. Final Answer:

    Missing parentheses around the subquery after ANY. -> Option D
  4. Quick Check:

    ANY requires parentheses around subquery [OK]
Quick Trick: Always put subquery in parentheses after ANY [OK]
Common Mistakes:
  • Omitting parentheses around subquery
  • Misplacing ANY keyword
  • Confusing ANY with ALL syntax

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes