# Statistics

Statistics mk Tue, 11/19/2013 - 08:52The SQL implementation provides the well-known standard statistical aggregates COUNT, SUM, AVG, MIN and MAX over scalar types and groupings. In addition, a few important statistical aggregate functions: MEDIAN, QUANTILE, and correlation CORR are available. The percentile is a float value between 0.0 and 1.0. MEDIAN(<expr>) is equivalent to QUANTILE(<expr>,0.5).

STDDEV_SAMP computes the cumulative sample standard deviation and returns the square root of the sample variance. STDDEV_POP computes the population standard deviation and returns the square root of the population variance. Both functions take takes as an argument any numeric datatype.

Likewise, VAR_SAMP and VAR_POP function returns the sample variance (/n-1) of a set of numbers and the biased variance (/n) of a set of numbers, respectively.

stat_funcs:QUANTILE '(' scalar_expr ',' scalar_expr ')'| STDDEV_SAMP '(' scalar_expr ')'| STDDEV_POP '(' scalar_expr ')'| VAR_SAMP '(' scalar_expr ')'| VAR_POP '(' scalar_expr ')'| MEDIAN '(' scalar_expr ')'| CORR '(' scalar_expr',' scalar_expr ')' |