QUANTILE(numeric_exp, Q_numeric_exp)

Returns the quantile specified by Q_numeric_exp for the population of numeric_exp.
 
Description

The quantile of a distribution of values is a number xp such that a given proportion of the population values are less than or equal to xp. For example, the 0.75 quantile (also referred to as the 75th percentile or upper quartile) of a variable is a value xp such that 75% of the values of the variable fall below that value. The 0.5 quantile is the median.

 

Parameters

numeric_exp must be a number, or a numeric expression.

Q_numeric_exp (the quantile to compute) must be a floating point number strictly between 0 and 1.

Note: If the number of data points is less than QUANTILE_ESTIMATION_THRESHHOLD, then the calculation for a median or quantile will proceed as follows:

 

  • If the data is not sorted on any columns for which calculation is requested, the data will be sorted.

  • The quantile position is calculated by linear interpolation.

If the number of data points is greater than or equal to QUANTILE_ESTIMATION_THRESHHOLD, then the calculation for a median or quantile will proceed as follows:

The quantile position will be estimated by the linear time selection algorithm "Randomized-Select" as described in Introduction to Algorithms by Cormen, Leiserson, and Rivest, p. 187.