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

# std

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

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

## 语法

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

## 参数说明

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

## 返回值说明

返回 DOUBLE 类型的值。

## 示例

示例数据集：

```plaintext theme={null}
MySQL [test]> select * from std_test;
+------+------+
| col0 | col1 |
+------+------+
|    0 |    0 |
|    1 |    2 |
|    2 |    4 |
|    3 |    6 |
|    4 |    8 |
+------+------+
```

计算 `col0` 和 `col1` 的标准差。

```plaintext theme={null}
MySQL > select std(col0) as std_of_col0, std(col1) as std_of_col1 from std_test;
+--------------------+--------------------+
| std_of_col0        | std_of_col1        |
+--------------------+--------------------+
| 1.4142135623730951 | 2.8284271247461903 |
+--------------------+--------------------+
```

## Keywords

STD


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