VAR_SAMP() OVER ...
All functions > WINDOW FUNCTION > VAR_SAMP() OVER ...
Returns the sample variance over the window frame.
Syntax
VAR_SAMP(expr) OVER ([PARTITION BY expr [, ...]] [ORDER BY sort_item [, ...]] [ROWS|RANGE|GROUPS frame])
Notes
- Computes sample variance (divides by N-1) 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, 3.0E0, 5.0E0] AS x).TRANSFORM(SELECT VAR_SAMP(x) OVER (ORDER BY id ASC)).UNWRAP() -- Sample variance of x in the frame (id is only the sort key)
;Result
| f1 ARRAY |
|---|
| [null, 2.00, 4.00] |