Skip to main content
Aggregate · Window
NULL values are ignored. No values yields NULL; one value yields zero.

Syntax

A window function keeps each input row and adds a result for that row. PARTITION BY groups rows with matching values; without it, all input rows form one group.

Aggregate

Window

Arguments

Aggregate and window

Returns

  • Type: DOUBLE
  • NULL behavior: NULL values are ignored. No values yields NULL; one value yields zero.
  • Empty input: Returns NULL on empty input.

Properties

Usage notes

  • Returns DOUBLE. Sample statistics divide by n − 1; population statistics divide by n, where n is the number of included values.
  • INTEGER and INT mean the same type; STRING means VARCHAR text. NULL can be used with a supported type. Cast NULL explicitly when its type would otherwise be unclear.
  • DISTINCT is not supported for this standard-deviation function.

Examples

Population standard deviation

For the population values 0 and 2, the mean is 1 and the population standard deviation is 1.

Groups with different numbers of values

NULL values are excluded from the calculation. Results are rounded to six decimal places where needed.

Limitations

  • The result is DOUBLE. Query tools may report the input’s floating-point or decimal type, but that does not change the returned value’s type.
  • STDDEV_POP does not accept DISTINCT. To calculate over unique values, remove duplicates in a subquery first.
Last modified on October 15, 2026