T-SQL 101: 112 Excluding Data with EXCEPT
We saw how UNION and UNION ALL worked in the last T-SQL 101 post. Sometimes you want to work with two (or more) row sets in other ways.
The EXCEPT clause says that I want all the distinct entries in the first row set unless they also exist in the second row set.
In some database engines, this operator is called MINUS, but EXCEPT is the ANSI SQL standard, and that’s what SQL Server uses.
2025-02-09