The CORR Function in Oracle SQL / PLSQL is used to calculate the coefficient of correlation in a set of numbers.
Syntax for the using the CORR Function in Oracle SQL / PLSQL is:
SELECT CORR(n,m)[OVER analytic_clause]
- n and m are numbers used to calculate the coefficient of correlation.
- The CORR function in Oracle SQL / PLSQL requires at least 2 records or rows in a table.
Using CORR Function in Oracle SQL / PLSQL SELECT statement:
Suppose we have a table named ‘employee’ as shown below:
If we write our CORR Function query as:
SELECT CORR(salary, commission)
We will get ‘-0.174844651545059’ as output.