Two more set operators compare query results row by row:
A INTERSECT B returns the rows that are in both.
A EXCEPT B returns the rows in A that aren't in B. Oracle calls it MINUS.
The same rules as UNION apply: matching column counts and types, and duplicates removed (INTERSECT ALL and EXCEPT ALL keep them).
SELECT customer_id FROM orders
INTERSECT
SELECT customer_id FROM tickets;
One difference from =: set operators treat two NULLs as the same value. If both sides contain a NULL, EXCEPT removes it and INTERSECT keeps it. That makes them handy for comparing whole rows, for example checking that two versions of a table match: A EXCEPT B and B EXCEPT A should both be empty.