STDDEV
Description
The STDDEV function computes the sample standard deviation of a set of numeric values. It is a commonly used aggregate function in statistics for measuring data dispersion. This function is a synonym of the STD aggregate function, and returns a DOUBLE value.
Syntax
Parameters
expr: An expression that evaluates to a numeric value. The expression can be a column name, a calculation formula, or any other expression that returns a numeric value.
Return Value
- Returns a
DOUBLEvalue representing the sample standard deviation. - If
DISTINCTis specified, the function computes the standard deviation on unique values ofexpronly. - If the aggregation group contains only one row, the function returns
NULL.
Examples
Example 1: Compute the standard deviation of all values
Example 2: Compute the standard deviation of unique values
Example 3: Use FILTER clause to conditionally compute standard deviation
Example 4: Combine FILTER clause and DISTINCT to compute conditional standard deviation
