

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# COUNT 和 COUNT DISTINCT函數
<a name="count-function"></a>

COUNT 函數會計算運算式定義的資料列。COUNT DISTINCT 函數會計算資料欄或表達式中不同非 NULL 值的數量。它會先消除指定表達式中的所有重複值，再執行計數。

## 語法
<a name="count-function-syntax"></a>

```
COUNT (DISTINCT column)
```

## 引數
<a name="count-function-arguments"></a>

*欄位*  
函數操作的目標欄。

## 資料類型
<a name="count-function-data-types"></a>

COUNT 函數和 COUNT DISTINCT函數支援所有引數資料類型。

COUNT DISTINCT 函數會傳回 BIGINT。

## 範例
<a name="count-function-examples"></a>

計算佛羅里達州的所有使用者。

```
select count (identifier) from users where state='FL';
```

計算EVENT資料表中的所有唯一場地 IDs。

```
select count (distinct venueid) as venues from event;
```