Bird
0
0

What does the INTERSECT operator do in PostgreSQL?

easy📝 Conceptual Q11 of 15
PostgreSQL - Set Operations and Advanced Queries
What does the INTERSECT operator do in PostgreSQL?
AReturns rows only in the second query
BReturns all rows from the first query
CCombines all rows from both queries without duplicates
DReturns rows common to both queries
Step-by-Step Solution
Solution:
  1. Step 1: Understand INTERSECT purpose

    INTERSECT returns only rows that appear in both query results.
  2. Step 2: Compare with other set operations

    Unlike UNION or EXCEPT, INTERSECT finds common rows, not all or unique rows.
  3. Final Answer:

    Returns rows common to both queries -> Option D
  4. Quick Check:

    INTERSECT = common rows [OK]
Quick Trick: INTERSECT = find common rows between two queries [OK]
Common Mistakes:
  • Confusing INTERSECT with UNION
  • Thinking INTERSECT returns all rows from first query
  • Mixing INTERSECT with EXCEPT

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes