PERCENTILE Function | Teradata Vantage - PERCENTILE - Advanced SQL Engine - Teradata Database

Time Series Tables and Operations

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-28
dita:mapPath
zzg1600277315070.ditamap
dita:ditavalPath
zzg1600277315070.ditaval
dita:id
B035-1208
lifecycle
previous
Product Category
Teradata Vantageā„¢

Returns the value which represents the desired percentile from each group. PERCENTILE is a single-threaded function.

To invoke the time series version of this function, use the GROUP BY TIME clause. For more information, see GROUP BY TIME Clause.

Return Values

This function returns the REAL data type.

Nulls are not included in the result computation.

The result value is determined by the desired index (di) in an ordered list of values. The following equation is for the di:

di = (number of values in group - 1) * percentile/100

When di is a whole number, that value is the returned result. The di can also be between two data points, i and j, where i<j. In this case, the result is interpolated according to one of the following schemes:
  • Linear interpolation. The result value is computed using the following equation:

    result = i + (j - i) * (di/100)MOD 1

    Specify by using the optional interpolation parameter with a value of LINEAR. LINEAR is the default scheme for interpolation.

  • Low value. The result value is equal to i. Specify by using the optional interpolation parameter with a value of LOW.
  • High value. the result value is equal to j. Specify by using the optional interpolation parameter with a value of HIGH.
  • Nearest value. The result value is i if (di/100 )MOD 1 <= .5; otherwise, it is j. Specify by using the optional interpolation parameter with a value of NEAREST.
  • Midpoint. The result value is equal to (i+j)/2. Specify by using the optional interpolation parameter with a value of MIDPOINT.

Usage Notes

PERCENTILE is valid only for numeric data.