EXCEPT
keywordThe EXCEPT
keyword can be used to efficiently get the difference between two
sets in Postgres.
SELECT *
FROM generate_series(0, 100) AS amount
EXCEPT
SELECT generate_series(1, 99) AS amount
ORDER BY amount;
-- amount
-- --------
-- 0
-- 100