SQL
`INTERSECT`
The `INTERSECT` clause can be used to select all rows that occur in the result of **both** queries.  
#### Vanilla `INTERSECT` (Set Semantics) {#docs:sql:query_syntax:setops::vanilla-intersect-set-semantics}  
Vanilla `INTERSECT` performs duplicate elimination, so only unique rows are returned.  
```sql
SELECT * FROM range(2) t1(x)
INTERSECT
SELECT * FROM range(6) t2(x);
```  
| x |
|--:|
| 0 |
| 1 |  
#### `INTERSECT ALL` (Bag Semantics) {#docs:sql:query_syntax:setops::intersect-all-bag-semantics}  
`INTERSECT ALL` follows bag semantics, so duplicates are returned.  
```sql
SELECT unnest([5, 5, 6, 6, 6, 6, 7, 8]) AS x
INTERSECT ALL
SELECT unnest([5, 6, 6, 7, 7, 9]);
```  
| x |
|--:|
| 5 |
| 6 |
| 6 |
| 7 |