# stddev_pop

Calculates the population standard deviation.

The result is the square root of the population variance, [`var_pop`](https://coordinatordb.com/docs/reference/functions/aggregate-functions/var-pop). It has the same units as the observations.

**Syntax**

```text
stddev_pop(x)
```

**Arguments**

* `x` — A numeric column or expression. `NULL` values are skipped.

**Calculation**

```text
sqrt(sum((x - mean) * (x - mean)) / (n))
```

`mean` is the arithmetic mean of the non-`NULL` values, and `n` is their count. The population calculation uses `n` because the observations describe the entire population.

**Returned value**

An approximate `REAL` value. Empty or all-`NULL` input returns `NULL`; one non-`NULL` input returns `0.0`. Nonfinite inputs return `NULL`; finite arithmetic overflow raises `NUMERIC_OVERFLOW`.

**Examples**

**Measuring the spread of readings**

```sql
CREATE TABLE readings (value INTEGER);
INSERT INTO readings VALUES (1), (3), (5), (7), (9), (NULL);
```

```sql
SELECT round(stddev_pop(value), 6) AS result
FROM readings
FORMAT csv;
```

```text
2.828427
```

**A single observation**

```sql
CREATE TABLE single_reading (value INTEGER);
INSERT INTO single_reading VALUES (7), (NULL);
```

```sql
SELECT stddev_pop(value)
FROM single_reading
FORMAT csv;
```

```text
0.0
```
