> ## Documentation Index
> Fetch the complete documentation index at: /documents/llms.txt
> Use this file to discover all available pages before exploring further.

# stddev, stddev_pop, std

> 返回表达式的总体标准差，支持作为窗口函数使用。

返回 `expr` 表达式的总体标准差。从 2.5.10 版本开始，该函数也可以用作窗口函数。

### 语法

```Haskell theme={null}
STDDEV(expr)
```

## 参数说明

`expr`: 被选取的表达式。当表达式为表中一列时，支持以下数据类型: TINYINT、SMALLINT、INT、BIGINT、LARGEINT、FLOAT、DOUBLE、DECIMAL。

## 返回值说明

返回值为 DOUBLE 类型。计算公式如下，其中 `n` 为该表的行数：

![image](https://mintcdn.com/mirrorship-docs/8FakUMFrFjmoxRt5/documents/images/e9abc96e61e7f8fbdf504e35.png?fit=max\&auto=format\&n=8FakUMFrFjmoxRt5\&q=85\&s=4e7a50472b1a43af049ce366548c79f1)

## 示例

```plaintext theme={null}
mysql> SELECT stddev(lo_quantity), stddev_pop(lo_quantity) from lineorder;
+---------------------+-------------------------+
| stddev(lo_quantity) | stddev_pop(lo_quantity) |
+---------------------+-------------------------+
|   14.43100708360797 |       14.43100708360797 |
+---------------------+-------------------------+
```

## 相关函数

[stddev\_samp](/documents/cn/4.2/sql-reference/sql-functions/aggregate-functions/stddev_samp.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.