Bird
0
0

Why does the INTERSECT operator remove duplicates in PostgreSQL result sets?

hard📝 Conceptual Q10 of 15
PostgreSQL - Set Operations and Advanced Queries
Why does the INTERSECT operator remove duplicates in PostgreSQL result sets?
ABecause duplicates cause syntax errors with INTERSECT
BBecause INTERSECT returns a set, which by definition has unique elements
CBecause INTERSECT uses DISTINCT internally by default
DBecause INTERSECT only works on primary keys
Step-by-Step Solution
Solution:
  1. Step 1: Understand set operations in SQL

    INTERSECT returns the intersection of two sets, and sets contain unique elements only.
  2. Step 2: Recognize that duplicates are removed by definition

    Therefore, duplicates are removed automatically to maintain set semantics.
  3. Final Answer:

    Because INTERSECT returns a set, which by definition has unique elements -> Option B
  4. Quick Check:

    INTERSECT returns unique rows by set definition [OK]
Quick Trick: INTERSECT results are unique because sets have no duplicates [OK]
Common Mistakes:
  • Thinking duplicates cause errors
  • Assuming INTERSECT works only on keys
  • Believing duplicates are preserved

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes