VARIANCE()
Returns the variance (squared spread) of a set of numeric values.
Description
VARIANCE is an aggregate function that measures how far a set of numbers
spreads from their mean, squared. It's the square of the standard deviation and
is widely used in statistics. A larger variance means the values are more
dispersed.
Syntax
VARIANCE(expression)
VAR_SAMP(expression)
VAR_POP(expression)Parameters
| Name | Description | Optional |
|---|---|---|
| expression | A numeric column or expression. | No |
Return Type
Returns a DOUBLE. With fewer than two non-NULL values it typically returns
NULL.
Examples
Employees & Departments
Loading database engine...
Employees & Departments
Loading database engine...
Variance vs STDDEV
STDDEV is just the square root of VARIANCE. Use variance when you need the
squared unit, or standard deviation for an interpretable, same-unit measure.
Common Mistakes
- Mixing sample and population.
VAR_SAMPvsVAR_POPdiffer slightly;VARIANCEusually means the sample form. - Interpreting the unit. Variance is in squared units, which can be hard to
reason about — prefer
STDDEVfor readability. - Non-numeric input. Variance requires numbers; text columns will error.
Related Functions
See also: AVG, STDDEV.