SQL SUM function
Adds up all the values in a numeric field and returns one total, e.g. SELECT SUM(Score) FROM Results; gives one row. It only works on numbers.
Understanding SQL SUM function in IGCSE Computer Science Paper 2
What it does: Quantity is an integer field, so SUM adds all its values and returns one row holding the total. Mark holds numbers, so it can be added. SUM cannot be used on text fields such as Surname. SUM combines all the values into a single total, so the output is one row. The field name must go inside brackets after SUM: SUM(Price). 2 + 0 + 3 + 1 = 6. The answer 4 is what COUNT would give, as it counts the records. SUM needs numbers to add, so it works on integer and real fields only.
Common mistakes: The keyword is misspelled. It should be FROM Results, because FROM names the table that SUM reads. SUM needs brackets around the field name. It should be SUM(Score).
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 525–538) and word search (Modules 500–538).
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
SUM(field)Fill in the Blanks
Spot the Error
Student with a class code? Join your class →