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

> 计算不同参数值的精确数量。

# uniqExact

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

Introduced in：v1.1.0

计算不同参数值的精确数量。

<Warning>
  `uniqExact` 函数比 `uniq` 占用更多内存，因为随着不同值的数量增加，其状态大小会无限增长。
  只有在你确实需要精确结果时，才应使用 `uniqExact` 函数。
  否则，请使用 [`uniq`](/zh/reference/functions/aggregate-functions/uniq) 函数。
</Warning>

**Syntax**

```sql theme={null}
uniqExact(x[, ...])
```

**参数**

* `x` — 该函数接受可变数量的参数。[`Tuple(T)`](/zh/reference/data-types/tuple) 或 [`Array(T)`](/zh/reference/data-types/array) 或 [`Date`](/zh/reference/data-types/date) 或 [`DateTime`](/zh/reference/data-types/datetime) 或 [`String`](/zh/reference/data-types/string) 或 [`(U)Int*`](/zh/reference/data-types/int-uint) 或 [`Float*`](/zh/reference/data-types/float) 或 [`Decimal`](/zh/reference/data-types/decimal)

**返回值**

返回不同参数值的精确数量，类型为 UInt64。[`UInt64`](/zh/reference/data-types/int-uint)

**示例**

**基本用法**

```sql title=Query theme={null}
CREATE TABLE example_data
(
    id UInt32,
    category String
)
ENGINE = Memory;

INSERT INTO example_data VALUES
(1, 'A'), (2, 'B'), (3, 'A'), (4, 'C'), (5, 'B'), (6, 'A');

SELECT uniqExact(category) as exact_unique_categories
FROM example_data;
```

```response title=Response theme={null}
┌─exact_unique_categories─┐
│                       3 │
└─────────────────────────┘
```

**多个参数**

```sql title=Query theme={null}
SELECT uniqExact(id, category) as exact_unique_combinations
FROM example_data;
```

```response title=Response theme={null}
┌─exact_unique_combinations─┐
│                         6 │
└───────────────────────────┘
```

**另请参阅**

* [uniq](/zh/reference/functions/aggregate-functions/uniq)
* [uniqCombined](/zh/reference/functions/aggregate-functions/uniqCombined)
* [uniqHLL12](/zh/reference/functions/aggregate-functions/uniqHLL12)
* [uniqTheta](/zh/reference/functions/aggregate-functions/uniqthetasketch)
