Bird
0
0

What does the EXISTS keyword do in a SQL query?

easy📝 Conceptual Q11 of 15
PostgreSQL - Subqueries in PostgreSQL
What does the EXISTS keyword do in a SQL query?
AChecks if a subquery returns any rows and returns true or false
BCounts the total number of rows in a table
CJoins two tables based on a condition
DDeletes rows from a table
Step-by-Step Solution
Solution:
  1. Step 1: Understand the purpose of EXISTS

    The EXISTS keyword is used to check if a subquery returns any rows. It returns true if there is at least one row, otherwise false.
  2. Step 2: Compare with other options

    Counting rows, joining tables, or deleting rows are different SQL operations unrelated to EXISTS.
  3. Final Answer:

    Checks if a subquery returns any rows and returns true or false -> Option A
  4. Quick Check:

    EXISTS = true if subquery has rows [OK]
Quick Trick: EXISTS means: 'Is there at least one row?' [OK]
Common Mistakes:
  • Confusing EXISTS with COUNT
  • Thinking EXISTS joins tables
  • Assuming EXISTS deletes data

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes