Chapter 26 - The Quantile Function

“There is flattery in friendship.”

- William Shakespeare

The Quantile Function and Syntax

The syntax for the Quantile function:

 

QUANTILE (<partitions>, <column-name> ,<sort-key> [DESC | ASC])
[QUALIFY QUANTILE (<column-name>) {< | > | = | <= | >=} <number-of-rows>]

 

 

A Quantile is used to divide rows into a number of categories or grouping of roughly the same number of rows in each group. The percentile is the QUANTILE most commonly used in business. This means that the request is based on a value of 100 for the number of partitions. It is also possible to have quartiles (based on 4), tertiles (based on 3) and deciles (based on 10).

By default, both the QUANTILE column and the QUANTILE value itself ...

Get Tera-Tom's 1000 Page e-Book on Teradata Architecture and SQL, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.