> ## Documentation Index
> Fetch the complete documentation index at: https://docs.e6data.com/llms.txt
> Use this file to discover all available pages before exploring further.

# EXCEPT

> Leave columns out of SELECT *, or remove the rows of one query from another.

<div className="e6-meta"><span className="e6-eyebrow e6-eyebrow--quiet">SELECT clause · Set operator</span></div>

`EXCEPT` has two uses in Query Engine: excluding columns from `SELECT *`, and subtracting one query's rows from another's.

## SELECT \* EXCEPT

Returns every column except the ones you list. Useful for wide tables where you want all but a few columns.

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT * EXCEPT (<column> [, ...]) FROM ...
```

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
WITH cte AS (SELECT 5 AS c1, 'e6data' AS c2, 10 AS c3)
SELECT * EXCEPT (c3, c2) FROM cte;
```

| c1 |
| - |
| 5 |

## EXCEPT set operator

Returns the rows of the first query that aren't in the second, with duplicates removed.

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT ...
EXCEPT
SELECT ...
```

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
WITH cte AS (
  SELECT 1 AS id, 'AAAA' AS name
  UNION ALL SELECT 2, 'AAAB'
  UNION ALL SELECT 3, 'AAAC'
  UNION ALL SELECT 4, 'AAAD'
)
SELECT * FROM cte
EXCEPT
SELECT * FROM cte WHERE id < 3
ORDER BY 1, 2;
```

| id | name |
| - | - |
| 3 | AAAC |
| 4 | AAAD |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.