Population Standard Deviation (STDDEV_POP)
Description
The STDDEV_POP function calculates the population standard deviation of a set of numeric data. Standard deviation is a statistical measure of data dispersion, used to indicate the degree to which values in a dataset deviate from the mean.
Parameter Description
expr: The numeric data for which the standard deviation needs to be calculated. Can be of typeTINYINT,SMALLINT,INT,BIGINT,FLOAT,DOUBLE, orDECIMAL.DISTINCT: Optional parameter indicating whether to calculate the standard deviation of the distinct set. IfDISTINCTis set, the function only calculates the standard deviation of non-duplicate data.
Return Result
- Returns a
DOUBLEtype value representing the calculation result. - If all input values are
NULL, returnsNULL.
Usage Examples
Example 1: Calculate the population standard deviation of a set of numeric data
Example 2: Calculate the population standard deviation after deduplication
Example 3: Use the FILTER clause to conditionally calculate the population standard deviation
Example 4: Combine FILTER clause and DISTINCT to calculate the conditional population standard deviation
With the above examples, you can flexibly use the STDDEV_POP function to calculate the population standard deviation of a dataset according to your actual needs.
