EXCEPT keeps rows found only in the first result
EXCEPT compares two SELECT results and keeps rows from the first result that do not appear in the second. The order matters: swapping the two SELECT statements changes the answer. Both sides must return the same number of compatible columns.
A tiny example
In plain English: Show me the titles on the reading list that I have not finished.
SELECT title
FROM reading_list
EXCEPT
SELECT title
FROM finished_books;What comes back
| title |
|---|
| Wool |
| Piranesi |
Wool and Piranesi are on the reading list but not in finished_books.
Related SQL lessons
Ready for a break?
Take on today's cozy puzzle. A fresh, bite-sized query waits every morning — no timers, no pressure.
play today's sip