Bird
0
0

Which of the following is the correct syntax to use EXISTS in a WHERE clause?

easy📝 Syntax Q12 of 15
SQL - Subqueries
Which of the following is the correct syntax to use EXISTS in a WHERE clause?
ASELECT * FROM table WHERE EXISTS (SELECT column FROM table2);
BSELECT * FROM table WHERE EXISTS = (SELECT column FROM table2);
CSELECT * FROM table WHERE EXISTS IN (SELECT column FROM table2);
DSELECT * FROM table WHERE EXISTS LIKE (SELECT column FROM table2);
Step-by-Step Solution
Solution:
  1. Step 1: Review correct EXISTS syntax

    EXISTS is used as EXISTS (subquery) without any operator like =, IN, or LIKE.
  2. Step 2: Identify incorrect options

    Options B, C, and D misuse operators (=, IN, LIKE) with EXISTS, causing syntax errors.
  3. Final Answer:

    SELECT * FROM table WHERE EXISTS (SELECT column FROM table2); -> Option A
  4. Quick Check:

    EXISTS uses only parentheses for subquery [OK]
Quick Trick: EXISTS always followed by (subquery) without operators [OK]
Common Mistakes:
MISTAKES
  • Adding = or IN after EXISTS
  • Using LIKE with EXISTS
  • Forgetting parentheses around subquery

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes