Skip to content

CORR

  • expr1: This parameter is the first set of numeric values that Oracle’s CORR function will consider during calculation. It can refer to column name, constant value, expression, or function call. Non-numeric values get discarded and paired values with null are excluded from correlation calculation.
  • expr2: Similarly, this is the second set of numeric values in the correlation calculation. It also accepts column names, constant values, expressions, or function calls. Non-numeric values are excluded and pairs that include null value from either expr1 or expr2 are removed from the correlation computation.
SELECT CORR(sales, profit) as correlation
FROM sales_profit_data;
CORRELATION
----------------
0.89734

In the given example, the CORR function of Oracle SQL is used to find the correlation coefficient of sales and profit from the sales_profit_data table. The correlation coefficient is a statistical measure that calculates the strength of the relationship between the relative movements of the two variables. The value returned, 0.89734, indicates a strong positive relationship between sales and profit.