Syntax
Parameters
expr1 and expr2 must evaluate to TINYINT, SMALLINT, INT, BIGINT, LARGEINT, FLOAT, DOUBLE, or DECIMAL.
If expr1 and expr2 are table columns, this function calculates the correlation coefficient of these two columns.
Return value
Returns a DOUBLE value. The formula is as follows, wheren represents the row count of the table:

Usage notes
- A data row is counted only when the two columns in this row are non-null values. Otherwise, this data row is eliminated from the result.
-
0 is returned if
nis 1. - NULL is returned in any input is NULL.
Examples
Suppose tableagg has the following data:
k and v columns: