COVAR_POP
Calculate the covariance.
Example:
SELECT MGR , COVAR_POP ( SYSDATE - HIREDATE , sal ) AS covar_pop ,
COVAR_SAMP ( SYSDATE - HIREDATE , sal ) AS covar_samp
FROM emp GROUP BY MGR ORDER BY MGR , covar_pop , covar_samp ;
MGR | COVAR_POP | COVAR_SAMP
------+-------------------+---------------------
7566 | 0 | 0
7698 | 43976 | 54970
7782 | 0 |
7788 | 0 |
7839 | 10547.22222222222 | 15820.833333333332
7902 | 0 | 0
| 0 |
(7 rows)
COVAR_SAMP
Calculate the sample covariance.
Example:
SELECT MGR , COVAR_SAMP( SYSDATE - HIREDATE , sal ) AS covar_pop ,
COVAR_SAMP ( SYSDATE - HIREDATE , sal ) AS covar_samp
FROM emp GROUP BY MGR ORDER BY MGR , covar_pop , covar_samp ;
MGR | COVAR_POP | COVAR_SAMP
------+--------------------+---------------------
7566 | 0 | 0
7698 | 54970 | 54970
7782 | |
7788 | |
7839 | 15820.833333333332 | 15820.833333333332
7902 | 0 | 0
| |
(7 rows)
Top comments (0)