| title | sidebar_label | description |
|---|---|---|
| EXCEPT & INTERSECT keywords | EXCEPT & INTERSECT | EXCEPT and INTERSECT SQL keyword reference documentation. |
Returns distinct rows by comparing the results of two queries.
Syntax
EXCEPTreturns distinct rows from the left input query that aren’t output by the right input query.INTERSECTreturns rows that are returned by both input queries.
Examples
The below examples use long_sequence(n) to generate a list of integers from 1 to n.
EXCEPT
1. long_sequence(10) EXCEPT long_sequence(5);
INTERSECT
1. long_sequence(10) INTERSECT long_sequence(5);

