stddev_pop aggregate function (Databricks SQL)

Returns the population standard deviation calculated from values of a group.

Syntax

stddev_pop ( [ALL | DISTINCT] expr ) [FILTER ( WHERE cond ) ]

Arguments

  • expr: An expression that evaluates to a numeric.

  • cond: An optional boolean expression filtering the rows used for aggregation.

Returns

A DOUBLE.

If DISTINCT is specified the function operates only on a unique set of expr values.

Examples

> SELECT stddev_pop(col) FROM VALUES (1), (2), (3), (3) AS tab(col);
 0.82915619758885
> SELECT stddev_pop(DISTINCT col) FROM VALUES (1), (2), (3), (3) AS tab(col);
 0.816496580927726