Skip to main content
SQL โ€ข LESSON 164

INTERSECT

How can we find emails present in both customer and subscriber tables?

Advancedโฑ 3 Minutesโญ 1770 XP
๐Ÿค” THE QUESTION

How can we find emails present in both customer and subscriber tables?

๐Ÿ’ก WHAT IS IT?

INTERSECT returns only the distinct rows that appear in both query result sets.

๐ŸŽฏ WHAT IS IT USED FOR?

Finding overlap between customer lists and newsletter subscribers, shared account audits.

๐Ÿ’ป EXAMPLE
SELECT email
FROM customers
INTERSECT
SELECT email
FROM subscribers;

๐ŸŽฏ Mission Objectives

Practice typing production-grade SQL code for INTERSECT.

  • โœ“ INTERSECT operator
  • โœ“ Set intersection
  • โœ“ Shared record discovery
  • โœ“ List overlap