VAR_POP() OVER ...
All functions > WINDOW FUNCTION > VAR_POP() OVER ...
Returns the population variance over the window frame.
Syntax
VAR_POP(expr) OVER ([PARTITION BY expr [, ...]] [ORDER BY sort_item [, ...]] [ROWS|RANGE|GROUPS frame])
Notes
- Computes population variance (divides by N) over a window of rows
- NULL values are ignored in the calculation
See also
Examples
FeatureQL
SELECT
f1 := ZIP(ARRAY[10, 20, 30] AS id, ARRAY[1.0E0, 2.0E0, 3.0E0] AS x).TRANSFORM(SELECT VAR_POP(x) OVER (ORDER BY id ASC)).UNWRAP() -- Variance of x in the frame (id is only the sort key, not part of the aggregate)
;Result
| f1 ARRAY |
|---|
| [0.00, 0.25, 0.6666666666666666] |