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

# stddev_samp

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

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

## 语法

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

## 参数说明

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

## 返回值说明

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

![image](https://mintcdn.com/mirrorship-docs/sL46GVQByWEibCzI/documents/images/65a2c76b5a6aeda42adb39ee.png?fit=max\&auto=format\&n=sL46GVQByWEibCzI\&q=85\&s=553fd015429eabad522362ec9ecf06b1)

## 示例

```plaintext theme={null}
MySQL > select stddev_samp(scan_rows)
from log_statis
group by datetime;
+--------------------------+
| stddev_samp(`scan_rows`) |
+--------------------------+
|        2.372044195280762 |
+--------------------------+
```

## 相关函数

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


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