# quantilesExact (/docs/reference/sql/aggregate-functions/quantilesexact)



This page describes the RawTree engine binary used to generate this reference. It does not define Query API support. Descriptions retain upstream ClickHouse terminology. See [SQL interface scope](/docs/reference/clickhouse-compatibility#service-interfaces).

Exactly computes multiple [quantiles](https://en.wikipedia.org/wiki/Quantile) of a numeric data sequence at different levels simultaneously.

This function is equivalent to [`quantileExact`](/reference/functions/aggregate-functions/quantileExact) but allows computing multiple quantile levels in a single pass, which is more efficient than calling individual quantile functions.

To get exact values, all the passed values are combined into an array, which is then partially sorted. Therefore, the function consumes `O(n)` memory, where `n` is the number of values passed.

**Syntax**

```sql
quantilesExact(level1, level2, ...)(expr)
```

**Parameters**

* `level` — Levels of quantiles. One or more constant floating-point numbers from 0 to 1. We recommend using `level` values in the range of `[0.01, 0.99]`. [`Float*`](/reference/data-types/float)

**Arguments**

* `expr` — Expression over the column values resulting in numeric data types, `Date`, `DateTime` or `DateTime64`. [`(U)Int*`](/reference/data-types/int-uint) or [`Int128`](/reference/data-types/int-uint) or [`UInt128`](/reference/data-types/int-uint) or [`Int256`](/reference/data-types/int-uint) or [`UInt256`](/reference/data-types/int-uint) or [`Float*`](/reference/data-types/float) or [`Decimal*`](/reference/data-types/decimal) or [`Date`](/reference/data-types/date) or [`DateTime`](/reference/data-types/datetime) or [`DateTime64`](/reference/data-types/datetime64)

**Returned value**

Array of quantiles of the specified levels in the same order as the levels were specified. For numeric data types the output format matches the input format. [`Array((U)Int*)`](/reference/data-types/array) or [`Array(Int128)`](/reference/data-types/array) or [`Array(UInt128)`](/reference/data-types/array) or [`Array(Int256)`](/reference/data-types/array) or [`Array(UInt256)`](/reference/data-types/array) or [`Array(Float*)`](/reference/data-types/array) or [`Array(Decimal*)`](/reference/data-types/array) or [`Array(Date)`](/reference/data-types/array) or [`Array(DateTime)`](/reference/data-types/array) or [`Array(DateTime64)`](/reference/data-types/array)

**Examples**

**Computing multiple exact quantiles**

```sql title=Query
SELECT quantilesExact(0.25, 0.5, 0.75)(number) FROM numbers(10)
```

```text title=Response
┌─quantilesExact(0.25, 0.5, 0.75)(number)─┐
│ [2,5,7]                                 │
└─────────────────────────────────────────┘
```

*Introduced in version 1.1.0.*
