SQLite Aggregate Functions

This page contains a list of aggregate functions that are available in SQLite by default.

FunctionDescription
avg()Returns the average value of all non-NULL values within a group.
count()Can be used to return the number of rows in a result set.

It can also be used to return the number of times a given column is not NULL in the result set.
group_concat()Allows you to concatenate multiple results returned for a column into one.Sometimes referred to as “string aggregation”.
max()Returns the maximum value from all values in a group.

The maximum value is the value that would appear last in a query that uses an ORDER BY clause on the same column.
min()Returns the minimum non-NULL value from all values in a group.

The minimum value is the value that would appear first in a query that uses an ORDER BY clause on the same column.
sum()Returns the sum of all non-NULL values in a group. If there are no non-NULL values, then it returns NULL.
total()Returns the sum of all non-NULL values in a group. If there are no non-NULL values, then it returns 0.0.

Additional aggregate functions written in C can be added using the sqlite3_create_function() API.