Skip to main content Skip to complementary content

Aggregation functions

Aggregation functions are usually used with a GROUP BY clause, but they can also be used in standard FROM-WHERE-SELECT clauses.

When to use aggregation functions

Aggregation functions operate in iterative contexts, processing values across multiple rows or elements. Use aggregation functions when working with queries that include GROUP BY clauses or when aggregating values from a dataset in a FROM-SELECT query.

For example, to calculate the average rating across all customer records:
FROM customer
SELECT avg(rating)

To distinguish aggregation functions from array functions: aggregation functions process values in an iterative context, while array functions operate on a single collection value. For array operations, see Array functions.

Additional aggregation functions

The following functions can also be used as aggregation functions:

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!