Bird
0
0

What is the main purpose of using EXISTS in a SQL query?

easy📝 Conceptual Q1 of 15
PostgreSQL - Subqueries in PostgreSQL
What is the main purpose of using EXISTS in a SQL query?
ATo count the number of rows in a table
BTo join two tables based on a condition
CTo check if a subquery returns any rows
DTo update rows in a table
Step-by-Step Solution
Solution:
  1. Step 1: Understand the role of EXISTS

    EXISTS checks if the subquery returns at least one row.
  2. Step 2: Compare with other options

    Counting rows, joining tables, or updating rows are different SQL operations.
  3. Final Answer:

    To check if a subquery returns any rows -> Option C
  4. Quick Check:

    EXISTS usage = B [OK]
Quick Trick: EXISTS returns true if subquery has rows, false otherwise [OK]
Common Mistakes:
  • Confusing EXISTS with COUNT
  • Thinking EXISTS joins tables
  • Using EXISTS to update data

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes