Skip to main content
SQL โ€ข LESSON 165

EXCEPT

How can we find customers who are not in the unsubscribed list?

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

How can we find customers who are not in the unsubscribed list?

๐Ÿ’ก WHAT IS IT?

EXCEPT returns rows from the first query that do not exist in the second query.

๐ŸŽฏ WHAT IS IT USED FOR?

Suppression list filtering, churn audits, finding uncontacted customers.

๐Ÿ’ป EXAMPLE
SELECT email
FROM customers
EXCEPT
SELECT email
FROM unsubscribed_customers;

๐ŸŽฏ Mission Objectives

Practice typing production-grade SQL code for EXCEPT.

  • โœ“ EXCEPT operator
  • โœ“ Set difference
  • โœ“ Suppression filtering
  • โœ“ Exclusion logic