SUM adds up a whole column
SUM takes one column of numbers and returns the total, the way you'd add up a receipt. Like COUNT, it turns many rows into one answer, so you get a single number back rather than a list of rows.
A tiny example
In plain English: Tell me the total number of pages across all the books in the books table.
SELECT SUM(pages)
FROM books;What comes back
| SUM(pages) |
|---|
| 1287 |
Every book's page count added together comes to 1287.
Related SQL lessons
Ready for a break?
Take on today's cozy puzzle. A fresh, bite-sized query waits every morning — no timers, no pressure.
play today's sip