Cloud

Overview

Aggregate functions compute a single result from a set of input values. Redpanda SQL supports the following aggregate functions:

Function Name Description

sum()

Calculates and returns the sum of all values

min()

Calculates and returns the minimum value

for_min()

Calculates and returns a value corresponding to the minimal metric in the same row from a set of values

max()

Calculates and returns the maximum value

for_max()

Calculates and returns a value corresponding to the maximum metric in the same row from a set of values

avg()

Calculates and returns the average value

count()

Counts the number of rows

bool_and()

Calculates the boolean of all the boolean values in the aggregated group. FALSE if at least one of aggregated rows is FALSE

bool_or()

Calculates the boolean of all the boolean values in the aggregated group. TRUE if at least one of aggregated rows is TRUE

Function qualifier Description

DISTINCT

Allows aggregation functions to operate on a distinct set of values within a column

You can utilize the aggregate functions with the GROUP BY and HAVING clauses in the SELECT statement.