Function Reference

STDDEV_POP

Returns the population standard deviation, that is, how far the values deviate from the mean on average.

MySQL 8.4
STDDEV_POP(expr)
expr
Numeric expression
DOUBLE

Return value

A floating-point number (DOUBLE); NULLs are ignored; 0 for a single value, NULL for an empty set

Examples

Spread of delivery time

MySQL 8.4
SELECT ROUND(AVG(delivery_time_min), 1) AS avg_minutes,
	ROUND(STDDEV_POP(delivery_time_min), 1) AS spread_minutes
FROM orders;
avg_minutesspread_minutes
67.530.6

A single value

MySQL 8.4
SELECT STDDEV_POP(x) AS one_value,
	STDDEV_SAMP(x) AS sample
FROM (
		SELECT 5 AS x
	) AS t;
one_valuesample
0<NULL>

Details

The sum of squared deviations is divided by the number of values, so the result is slightly smaller than that of STDDEV_SAMP. It fits when the rows contain all the data, not a sample. Synonyms in MySQL are STDDEV and STD.

See also