CORR() OVER ...

All functions > WINDOW FUNCTION > CORR() OVER ...

Returns the Pearson correlation coefficient over the window frame.

Syntax

CORR(expr_y, expr_x) OVER ([PARTITION BY expr [, ...]] [ORDER BY sort_item [, ...]] [ROWS|RANGE|GROUPS frame])

Notes

  • Returns a value between -1 (perfect negative) and 1 (perfect positive)
  • NULL values in either expression are excluded

See also

Examples

FeatureQL
SELECT
    f1 := ZIP(ARRAY[1,2,3] AS id, ARRAY[2.0E0,4.0E0,6.0E0] AS y, ARRAY[1.0E0,2.0E0,3.0E0] AS x).TRANSFORM(SELECT CORR(y, x) OVER (ORDER BY id ASC)).UNWRAP() -- Perfect linear correlation once two points exist
;
Result
f1 ARRAY
[null, 1.00, 1.00]

Last update at: 2026/05/26 17:22:09