← Databases & SQL
9 / 25
Lesson 9 — AVG, MIN, MAX and ROUND
AVG, MIN, MAX and ROUND
Besides COUNT and SUM there are three more everyday aggregates: AVG (average), MIN (smallest) and MAX (largest). ROUND(value, 2) rounds to 2 decimals, which keeps reports tidy.
SELECT MIN(price), MAX(price), ROUND(AVG(price), 2) FROM products
Aggregates skip NULL (missing) values automatically.
Why it matters: "average order value", "cheapest flight", "highest temperature" — these one-line queries power most reports.
Want it another way?
Task
Write the query returning MIN(score), MAX(score) and ROUND(AVG(score), 1). Expected: (55, 98, 79.2).
Run your code — when the output matches the task, you will see a green check. Then mark the lesson complete.
Test your knowledge
A quick 3-question quiz on this lesson — instant feedback.