

# `SELECT` list

The select list names the columns and expressions that the query returns, separated by commas. To name an output column, follow its expression with `AS` `alias`. To return every column of the `FROM` clause, use `*`.

An expression later in the select list can refer to the alias of an earlier one. The `WHERE`, `GROUP BY`, and `HAVING` clauses can also refer to select list aliases.

`#1` refers to the first column of the `FROM` clause, `#2` to the second, and so on. A comma after the last item of the select list is allowed.

## Syntax
<a name="athena-duckdb-statement-select-select-list-syntax"></a>

```sql
SELECT [ ALL | DISTINCT ] {{expression}} [ [ AS ] {{alias}} ]
    [, ...]
SELECT #{{n}} [ [ AS ] {{alias}} ] [, ...]
```

## Examples
<a name="athena-duckdb-statement-select-select-list-examples"></a>

For a description of the sample tables that the examples on this page use, see [SELECT statement in DuckDB](duckdb-statement-select.md).

The following SQL query returns every column and row of the `sales_parquet` table, sorted by `order_id`.

```sql
SELECT * FROM sales_db.sales_parquet ORDER BY order_id
```

The query returns the following results.


| order\_id | customer | region | amount | order\_date | 
| --- | --- | --- | --- | --- | 
| `1` | `alice` | `east` | `120.50` | `2026-10-01` | 
| `2` | `bob` | `west` | `75.00` | `2026-10-01` | 
| `3` | `carol` | `east` | `42.25` | `2026-10-02` | 
| `4` | `dave` | `north` | `310.00` | `2026-10-03` | 
| `5` | `erin` | `west` | `18.75` | `2026-10-03` | 
| `6` | `frank` | `east` | `NULL` | `2026-10-04` | 

The following SQL query names an expression `doubled` and uses that alias in the next expression of the same select list.

```sql
SELECT
    order_id,
    amount * 2 AS doubled,
    doubled + 1 AS doubled_plus_one
FROM sales_db.sales_parquet
WHERE order_id <= 2
ORDER BY order_id
```

The query returns the following results.


| order\_id | doubled | doubled\_plus\_one | 
| --- | --- | --- | 
| `1` | `241.00` | `242.00` | 
| `2` | `150.00` | `151.00` | 

The following SQL query uses `#2` to select the second column of a `VALUES` list.

```sql
SELECT #2 AS second_column
FROM (VALUES (1, 'a'), (2, 'b')) AS t(id, name)
ORDER BY second_column
```

The query returns the following results.


| second\_column | 
| --- | 
| `a` | 
| `b` | 