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

> 異なる引数値の正確な個数を計算します。

# uniqExact

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

導入バージョン: v1.1.0

異なる引数値の正確な個数を計算します。

<Warning>
  `uniqExact` 関数は、`uniq` よりも多くのメモリを使用します。異なる値の数が増えるにつれて state のサイズが際限なく増大するためです。
  正確な結果がどうしても必要な場合は、`uniqExact` 関数を使用してください。
  それ以外の場合は、[`uniq`](/ja/reference/functions/aggregate-functions/uniq) 関数を使用してください。
</Warning>

**構文**

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

**引数**

* `x` — この関数は可変個の引数を受け取ります。[`Tuple(T)`](/ja/reference/data-types/tuple) または [`Array(T)`](/ja/reference/data-types/array) または [`Date`](/ja/reference/data-types/date) または [`DateTime`](/ja/reference/data-types/datetime) または [`String`](/ja/reference/data-types/string) または [`(U)Int*`](/ja/reference/data-types/int-uint) または [`Float*`](/ja/reference/data-types/float) または [`Decimal`](/ja/reference/data-types/decimal)

**戻り値**

異なる引数値の正確な個数を UInt64 として返します。[`UInt64`](/ja/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](/ja/reference/functions/aggregate-functions/uniq)
* [uniqCombined](/ja/reference/functions/aggregate-functions/uniqCombined)
* [uniqHLL12](/ja/reference/functions/aggregate-functions/uniqHLL12)
* [uniqTheta](/ja/reference/functions/aggregate-functions/uniqthetasketch)
