operator

EXCEPT ALL

Subtracts right-side occurrence counts from left-side counts, with a minimum of zero. Example target: PostgreSQL 17. Use only the isolated starter dataset; setup and expected results are in the batch evidence.

Formal Syntax & Structure

sql syntaxsql
query EXCEPT ALL query

Working Example

Example Snippetsql
(SELECT 1 AS n UNION ALL SELECT 1 UNION ALL SELECT 1) EXCEPT ALL SELECT 1;
SQL Reference