> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-8a08bda2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> 与 quantileExact 类似，该函数用于计算数值数据序列的精确[分位数](https://en.wikipedia.org/wiki/Quantile)。

# quantileExactLow

<div id="quantileExactLow">
  ## quantileExactLow
</div>

引入版本：v20.8.0

与 [`quantileExact`](/zh/reference/functions/aggregate-functions/quantileExact) 类似，此函数用于计算数值数据序列的精确[分位数](https://en.wikipedia.org/wiki/Quantile)。

为了得到精确值，所有传入的值都会合并到一个数组中，然后对其进行完全排序。
排序算法的复杂度为 `O(N·log(N))`，其中 `N = std::distance(first, last)`，即比较次数。

返回值取决于分位级别和所选元素的数量。也就是说，如果级别为 0.5，那么当元素个数为偶数时，该函数返回较低的中位数值；当元素个数为奇数时，则返回中间的中位数值。
中位数的计算方式与 Python 中使用的 [median\_low](https://docs.python.org/3/library/statistics.html#statistics.median_low) 实现类似。

对于所有其他级别，返回的是索引对应 `level * size_of_array` 的元素。

当在同一个查询中使用多个级别不同的 `quantile*` 函数时，它们的内部状态不会合并 (也就是说，查询效率会低于原本可达到的水平) 。
在这种情况下，请使用 [quantiles](/zh/reference/functions/aggregate-functions/quantiles) 函数。

**语法**

```sql theme={null}
quantileExactLow(level)(expr)
```

**别名**: `medianExactLow`

**参数**

* `level` — 可选。分位数级别。取值为 0 到 1 之间的常量浮点数。建议将 `level` 设在 `[0.01, 0.99]` 范围内。默认值：0.5。当 `level=0.5` 时，该函数计算中位数。[`Float*`](/zh/reference/data-types/float)

**Arguments**

* `expr` — 基于列值的表达式，结果必须为数值类型、Date 或 DateTime。[`(U)Int*`](/zh/reference/data-types/int-uint) 或 [`Float*`](/zh/reference/data-types/float) 或 [`Decimal*`](/zh/reference/data-types/decimal) 或 [`Date`](/zh/reference/data-types/date) 或 [`DateTime`](/zh/reference/data-types/datetime)

**返回值**

返回指定级别的分位数。[`Float64`](/zh/reference/data-types/float) 或 [`Date`](/zh/reference/data-types/date) 或 [`DateTime`](/zh/reference/data-types/datetime)

**示例**

**计算精确低分位数**

```sql title=Query theme={null}
SELECT quantileExactLow(number) FROM numbers(10);
```

```response title=Response theme={null}
┌─quantileExactLow(number)─┐
│                        4 │
└──────────────────────────┘
```

**计算指定分位水平**

```sql title=Query theme={null}
SELECT quantileExactLow(0.1)(number) FROM numbers(10);
```

```response title=Response theme={null}
┌─quantileExactLow(0.1)(number)─┐
│                             1 │
└───────────────────────────────┘
```
