COVAR_SAMP function in Oracle

COVAR_SAMP is one of the vital Analytic functions of Oracle. It is used to get the sample covariance of a set of number pairs. The COVAR_SAMP function is supported in the various versions of the Oracle/PLSQL, including, Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i and Oracle 8i.

Syntax:

COVAR_SAMP ( expr1, expr2 )

Parameters:
expr1, expr2: They are used to specify the numerical expressions to be used for calculation.

Example:

select COVAR_SAMP (avg_age, avg_marks)
from students;

Explanation:
Here, the sample covariance will be returned for the fields called ‘avg_age’ and ‘avg_marks’ of the ‘students’ table.

Please Share