VAR_POP
Returns the population variance, that is, the mean squared deviation from the mean.
MySQL 8.1
VAR_POP(expr)Parameters
- exprDOUBLE
- Numeric expression
Return value
A floating-point number (DOUBLE); NULLs are ignored; 0 for a single value, NULL for an empty set
Examples
Variance of delivery time
MySQL 8.1
SELECT ROUND(VAR_POP(delivery_time_min), 1) AS time_variance
FROM orders;A single value
MySQL 8.1
SELECT VAR_POP(x) AS one_value,
VAR_SAMP(x) AS sample
FROM (
SELECT 5 AS x
) AS t;Details
The sum of squared deviations is divided by the number of values. The synonym in MySQL is VARIANCE. The square root of the result equals STDDEV_POP.