SQL aggregate functions: COUNT, SUM, AVG, MIN, MAX
An aggregate function works out one value from many rows. COUNT, SUM, AVG, MIN and MAX give the count, total, mean, lowest and highest. This query returns the mean score.
Understanding SQL aggregate functions: COUNT, SUM, AVG, MIN, MAX in VCE Spreadsheets, SQL & Visualisation
What it does: SUM adds every value in the price column and returns one total. WHERE filters the rows first, then AVG works out the mean of only the Year 9 scores. COUNT(*) counts rows. SUM adds up the values in a number column, so it can't be used with * to count rows. MAX finds the highest value and MIN finds the lowest value. MIN is the aggregate function for the lowest value. LOW is not an SQL aggregate function. AVG adds the scores (18) and divides by how many there are (3), giving 6. The value 18 is what SUM would return.
Common mistakes: Text values in SQL must be in quotes. Maths should be written as 'Maths', otherwise SQL thinks it is a column name. SQL uses a single = to compare values, not ==. It should be WHERE status = 'paid';.
Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.
This module's key terms are also in a printable crossword (Modules 45–54) and word search (Modules 35–54).
Take this worksheet further — free with Cloodit
Each concept is reinforced from every angle — learned, then applied, then tested.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
Match the Pairs
Key Term
SELECT AVG(score) FROM results;Fill in the Blanks
Spot the Error
Student with a class code? Join your class →