Aggregates Aggregate

corr()

Returns the correlation coefficient for non-NULL pairs in a group.

Arguments & returns

corr(y, x)

Aggregate
Overload link yx Returns
#01 DOUBLEDOUBLE DOUBLE

Example

corr example
SQL
Haybarn WASM 1.5.5-rc3 · In your browser

Engine example with sample data · Run to view results.

In other engines

PostgreSQLcorr()

Same function
Used in larger rewrites 1

These examples use corr as one part of a larger SQL translation.

Snowflakecorr()

SELECT CORR(a, b)
In Haybarn
SELECT CASE WHEN ISNAN(CORR(a, b)) THEN NULL ELSE CORR(a, b) END

SQLGlot example ↗