# DISTINCT keyword

> **For AI agents:** the complete documentation index is at [llms.txt](https://questdb.com/docs/llms.txt). Every page is available as markdown by appending `.md` to its URL, or by sending an `Accept: text/markdown` request header.

DISTINCT SQL keyword reference documentation.

`SELECT DISTINCT` is used to return only distinct (i.e different) values from a
column as part of a [SELECT statement](/docs/query/sql/select/).

## Syntax

```questdb-sql
SELECT DISTINCT columnName [, columnName ...]
FROM tableName;
```

## Examples

The following query returns every unique symbol traded in the last hour.

```questdb-sql demo title="Distinct symbols"
SELECT DISTINCT symbol
FROM fx_trades
WHERE timestamp IN '$now - 1h..$now';
```

`SELECT DISTINCT` can be used with aggregation functions and filters.

```questdb-sql demo title="With aggregate"
SELECT DISTINCT symbol, count()
FROM fx_trades
WHERE timestamp IN '$today';
```

```questdb-sql demo title="With filter"
SELECT DISTINCT symbol, side, count()
FROM fx_trades
WHERE timestamp IN '$today'
  AND price > 1;
```
