--------------------- Statistical Functions --------------------- By the SQL specification, some statistical functions are defined. Function about variance and standard deviation are bellow. VAR_SAMP: return the sample variance. eq. (SUM( ^ 2) - SUM() ^ 2 / COUNT()) / (COUNT() - 1) VAR_POP: return the population variance. eq. (SUM( ^ 2) - SUM() ^ 2 / COUNT()) / COUNT() STDDEV_SAMP: return the sample standard deviation. eq. SQRT(VAR_SAMP()) COVAR_SAMP: return the sample population. eq. (SUM( * ) - SUM() * SUM() / COUNT(*)) / (COUNT(*) - 1) COVAR_POP: return the population covariance. eq. (SUM( * ) - SUM() * SUM() / COUNT(*)) / COUNT(*) CORR: returns the coefficient of correlation. eq. COVAR_POP(, ) / (STDDEV_POP() * STDDEV_POP()) Author: Hajime Nakagami Syntax: ::= () := { VAR_POP | VAR_SAMP | STDDEV_POP | STDDEV_SAMP } ::= (, ) := { COVAR_POP | COVAR_SAMP | CORR } Note: If VAR_SAMP, STDDEV_SAMP, COVAR_SAMP and result count is 0 or 1, return NULL. If VAR_POP, STDDEV_POP, COVAR_POP, CORR and result count is 0, return NULL. Example: SELECT STDDEV_SAMP(salary) FROM employees;