2022-04-09 13:29:05 +00:00
---
2024-03-11 20:24:33 +00:00
title: "varPop"
2024-06-24 11:52:30 +00:00
slug: "/en/sql-reference/aggregate-functions/reference/varPop"
sidebar_position: 210
2022-04-09 13:29:05 +00:00
---
2024-03-11 20:24:33 +00:00
## varPop
2022-04-09 13:29:05 +00:00
2024-11-23 12:52:48 +00:00
Calculates the population variance:
$$
\frac{\Sigma{(x - \bar{x})^2}}{n}
$$
2022-04-09 13:29:05 +00:00
2024-03-11 20:24:33 +00:00
**Syntax**
2023-09-07 03:46:27 +00:00
2024-03-11 20:24:33 +00:00
```sql
2024-06-14 13:33:19 +00:00
varPop(x)
2024-03-11 20:24:33 +00:00
```
2024-06-14 13:33:19 +00:00
Alias: `VAR_POP` .
2024-03-11 20:24:33 +00:00
**Parameters**
2024-06-14 13:33:19 +00:00
- `x` : Population of values to find the population variance of. [(U)Int* ](../../data-types/int-uint.md ), [Float* ](../../data-types/float.md ), [Decimal* ](../../data-types/decimal.md ).
2024-03-11 20:24:33 +00:00
**Returned value**
2024-06-14 13:33:19 +00:00
- Returns the population variance of `x` . [`Float64` ](../../data-types/float.md ).
2024-03-11 20:24:33 +00:00
**Example**
Query:
```sql
DROP TABLE IF EXISTS test_data;
CREATE TABLE test_data
(
2024-06-14 13:33:19 +00:00
x UInt8,
2024-03-11 20:24:33 +00:00
)
ENGINE = Memory;
2024-06-14 13:33:19 +00:00
INSERT INTO test_data VALUES (3), (3), (3), (4), (4), (5), (5), (7), (11), (15);
2024-03-11 20:24:33 +00:00
SELECT
2024-06-14 13:33:19 +00:00
varPop(x) AS var_pop
2024-03-11 20:24:33 +00:00
FROM test_data;
```
2024-04-29 05:09:20 +00:00
Result:
2024-03-11 20:24:33 +00:00
```response
2024-06-14 13:33:19 +00:00
┌─var_pop─┐
│ 14.4 │
└─────────┘
2024-03-11 20:24:33 +00:00
```