Categories:

Aggregate Functions (General) , Window Functions

STDDEV_POP

Returns the population standard deviation (square root of variance) of non-NULL values. If all records inside a group are NULL, returns NULL.

Syntax

STDDEV_POP([DISTINCT] x)

Examples

create or replace table aggr(k int, v decimal(10,2), v2 decimal(10, 2));
insert into aggr values(1, 10, null);
insert into aggr values(2, 10, 11), (2, 20, 22), (2, 25,null), (2, 30, 35);
select k, stddev_pop(v), stddev_pop(v2) from aggr group by k;

---+---------------+----------------+
 k | stddev_pop(v) | stddev_pop(v2) |
---+---------------+----------------+
 1 | 0             | [NULL]         |
 2 | 7.395099729   | 9.809292645    |
---+---------------+----------------+