VAR_SAMP() GROUP BY ...
All functions > GROUP BY > VAR_SAMP() GROUP BY ...
Returns the sample variance of the values in the group.
Syntax
VAR_SAMP(expr) [ FILTER (WHERE condition) ] [ GROUP BY feature [, feature ...] ]
Notes
- Computes the sample variance (divides by N-1, Bessel's correction)
- NULL values are excluded from the calculation
- Returns NULL if all values are NULL or group has fewer than 2 values
Examples
FeatureQL
SELECT
f1 := ZIP(ARRAY[1, 2, 3, 4] AS value).TRANSFORM(SELECT VAR_SAMP(value)).UNWRAP_ONE() -- Sample variance
;Result
| f1 VARCHAR |
|---|
| 1.6666666666666667 |