operator

EXCEPT

Returns distinct rows in the left input but not the right input. Both queries must return compatible columns. Example target: PostgreSQL 17 and SQLite (local fixture tested).

Formal Syntax & Structure

sql syntaxsql
query EXCEPT query

Working Example

Example Snippetsql
SELECT 1 EXCEPT SELECT 2 ORDER BY 1;
SQL Reference