Advanced aggregation
There are several aggregating functions that are executed in a special way.
The first group of such aggregating functions is called ordered-set aggregates. They take into account not just the values of the argument expressions, but also their order. They are related to statistics and calculate percentile values.
A percentile is the value of a group of numbers when the given percentage of other values is less than the percentile. For example, if a value is at the 95th percentile, this means that it's greater than 95 percent of the other values. In PostgreSQL, you can calculate a continuous or discrete percentile using the percentile_cont and percentile_disc functions, respectively.
A discrete percentile is one of the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access