stddev_pop
PG 8.0+→ double precisionReturns the population standard deviation of all non-null input values.
Signature
stddev_pop ( numeric ) → double precisionParameters
| Parameter | Type | Description |
|---|---|---|
| expression | numeric | Numeric values to compute population standard deviation over |
Examples
SELECT stddev_pop(score) FROM test_results;Population std dev of all scoresSELECT department, stddev_pop(salary) FROM employees GROUP BY department;Salary spread per departmentUse `stddev_pop` when your data IS the entire population. Use `stddev_samp` (or `stddev`) when your data is a sample. For small samples, the difference is significant.
SELECT stddev_pop(score) AS pop_sd, stddev_samp(score) AS sample_sd FROM scores;Compare population vs sample standard deviation