In Oracle/PLSQL, the corr function returns the coefficient of correlation of a set of number pairs.
Syntax 分析两列数值之间的相关系数
The syntax for the corr function is:
corr( n ,m ) [ over (analytic_clause) ]
n and m are the numbers to use to calculate the cofficient of correlation.
Note
The corr function requires at least two rows.
Applies To
- Oracle 11g, Oracle 10g, Oracle 9i, Oracle 8i
For Example
select corr(quantity, commission)
from sales;
Here is an example using the GROUP BY clause:
select max_entents, corr(max_trans, initial_extent)
from data
group by max_extents;