INTERSECT only keeps rows in both results
INTERSECT compares the complete rows returned by two SELECT statements. A row stays only when that same row appears in both results. Both SELECT statements must return the same number of compatible columns in the same order.
A tiny example
In plain English: Show me the titles that are on the reading list and in the library.
SELECT title
FROM reading_list
INTERSECT
SELECT title
FROM library_books;What comes back
| title |
|---|
| Dune |
Dune is the only title that appears in both the reading list and the library.
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