Bird
0
0

Which of the following is the correct syntax to use ANY with a subquery in PostgreSQL?

easy📝 Syntax Q12 of 15
PostgreSQL - Subqueries in PostgreSQL
Which of the following is the correct syntax to use ANY with a subquery in PostgreSQL?
ASELECT * FROM table WHERE column = ANY (SELECT col FROM othertable);
BSELECT * FROM table WHERE column ANY = (SELECT col FROM othertable);
CSELECT * FROM table WHERE ANY column = (SELECT col FROM othertable);
DSELECT * FROM table WHERE column = (ANY SELECT col FROM othertable);
Step-by-Step Solution
Solution:
  1. Step 1: Recall correct ANY syntax

    ANY is used as: column operator ANY (subquery), e.g., column = ANY (subquery).
  2. Step 2: Check each option

    SELECT * FROM table WHERE column = ANY (SELECT col FROM othertable); matches correct syntax. Others have misplaced ANY or wrong order.
  3. Final Answer:

    SELECT * FROM table WHERE column = ANY (SELECT col FROM othertable); -> Option A
  4. Quick Check:

    ANY goes after operator and before subquery in parentheses [OK]
Quick Trick: Use operator = ANY (subquery) syntax [OK]
Common Mistakes:
  • Placing ANY before the column name
  • Omitting parentheses around subquery
  • Using ANY without an operator

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes