operator

INTERSECT

Returns distinct rows common to both inputs. Both queries must return compatible columns. Example target: PostgreSQL 17 and SQLite (local fixture tested).

Formal Syntax & Structure

sql syntaxsql
query INTERSECT query

Working Example

Example Snippetsql
SELECT 1 INTERSECT SELECT 1 ORDER BY 1;
SQL Reference