Next: Relational expressions, Previous: Aggregate expressions, Up: Expressions [Contents][Index]

The following functions, referred to collectively as
<`aggr_func`>s, may be used in an aggregate
expression (see Aggregate
expressions):

<aggr_func> |
::= | [
`ARITHMETIC` ]
`MEAN` | `HARMONIC MEAN` |
`GEOMETRIC MEAN` | `MEDIAN` |
`STANDARD DEVIATION` | `VARIANCE` | ```
MEDIAN ABSOLUTE
DEVIATION
``` |
`SUM` |
`MINIMUM` | `MAXIMUM` | `FINAL` | <expr>
`PERCENTILE` |

`MEAN`

and `ARITHMETIC MEAN`

are
equivalent.
`MEDIAN`

is the value such that there are as many larger
as smaller values. If there are an even number of values, `MEDIAN`

is
the arithmetic mean of the two medians. `FINAL`

returns only the final
value measured. `PERCENTILE`

returns a given
percentile,
<`expr`>, of the values. <`expr`> must lie in the range
[0, 100]. Percentile values are computed as *x_g + (h - g)(x_g -
x_h)*, where *x* is the data in sorted order and
*h* is *(|x| - 1) * p/100 + 1* when computing the
value at the *p*th percentile. (See Wikipedia’s entry on
*quantile* for more information.) The interpretation of
the remaining aggregate functions should be unambiguous.