operator

INTERSECT ALL

Preserves the smaller occurrence count of each row across the two inputs; ordinary INTERSECT removes duplicates. 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 INTERSECT ALL query

Working Example

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