AGGREGATE FUNCTIONS

Aggregate functions operate on groups of rows to return a single value (i.e., row) for each group. For example, suppose we have the fictitious data set below highlighting a sample of iPhone sales.

purchase_idpurchase_datepurchase_amount
11/1/2022600
21/2/2022625.99
31/3/2022500
41/4/2022599
51/5/2022700

Using this data set, several common aggregations can be computed. The number of times the iPhone has been purchased, the lowest and highest values the iPhone was purchased at, the average amount the iPhone was purchased at, and the sum of all purchase amounts can be computed. Respectively, the COUNT, MIN, MAX, AVG, and SUM functions can be used to compute each of these values.

For a high-level overview and example use cases of these frequently used aggregate functions, check out the pages individually dedicated to them by using the menu or by clicking the links below.

AVG
COUNT
MIN
MAX
SUM