Skip to content

Stockertim Dictionary · Technology

Aggregate function

Also called aggregation function, SQL aggregate, summary function

In short

A function that reduces many values to a single summary value, such as COUNT, SUM, AVG, MIN or MAX in SQL, or the matching functions in spreadsheets and pandas.

  • Beginner
  • Concept
  • Checked

In detail

An aggregate function takes a column of values and returns one number. The five common ones in SQL are COUNT, which counts rows or non-blank values, SUM for a total, AVG for the arithmetic mean, and MIN and MAX for the smallest and largest. Used alone they summarise the whole table; used with GROUP BY they return one value per group.

COUNT comes in forms that give different answers. COUNT(*) counts rows, COUNT(column) counts rows where that column is not NULL, and COUNT(DISTINCT column) counts different values. On a table of 1,000 orders where 50 have no discount code, COUNT(*) gives 1,000 and COUNT(discount_code) gives 950.

Blanks are ignored by SUM, AVG, MIN and MAX. That is usually sensible, but it changes the meaning of an average: AVG of a column with gaps is the mean of the known values only, not the mean with blanks treated as zero. If zero is the right reading, the query must say so with COALESCE(column, 0).

Aggregates sit at the heart of reporting because management questions are usually totals, counts and averages. They also hide detail: an average can be pulled by a few extreme values, and a total says nothing about how it is spread. Analysts therefore often show a count beside each average and look at the minimum and maximum before trusting a summary.

Worked example

A school canteen in Kano records 200 meal sales one day, each with a price; 10 rows have no price because the till failed.

  1. COUNT(*) returns 200 and COUNT(price) returns 190.
  2. SUM(price) returns ₦95,000 from the 190 priced rows.
  3. AVG(price): ₦95,000 / 190 = ₦500

The average reflects 190 known sales; the 10 missing prices are reported separately rather than counted as free meals.

In practice

Every dashboard total, monthly count and average order value is an aggregate. In spreadsheets the same functions are SUM, COUNT, COUNTA, AVERAGE, MIN and MAX, and in pandas they are methods such as sum(), count() and mean() applied to a column or a grouped table.

Watch out

  • COUNT(column) skips blanks while COUNT(*) does not; mixing them up changes the denominator of a rate.
  • Averages of averages are wrong when groups differ in size; total the parts and divide again instead.

Learn it properly

Official sources

Facts last checked on 9 November 2026.

Education, not advice: the Stockertim Dictionary explains what terms mean. It never recommends buying or selling anything.

English