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

# var_samp, variance_samp

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

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

## 语法

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

## 参数说明

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

## 返回值说明

返回值为 DOUBLE 类型。

## 示例

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


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