AVG gives the average of a column
AVG adds up a column of numbers and divides by how many values there were — the average, worked out for you. It also turns many rows into one answer, so the result is a single number. Pair it with AS to give that number a clear heading.
A tiny example
In plain English: Tell me the average page count of all the books in the books table.
SELECT AVG(pages) AS average_pages
FROM books;What comes back
| average_pages |
|---|
| 214.5 |
The page counts total 1287 across 6 books, and 1287 ÷ 6 is 214.5.
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