๐Ÿ“Š We use cookies & analytics to improve your experience. Learn more
Latest

Data Analytics with SQL & Excel Module 2 ยท Lesson 5 of 15

0% Exit to course

Module 2 ยท SQL โ€” asking the database directly Lesson 5 of 15

GROUP BY and the aggregate functions

Learning objective

COUNT, SUM, AVG, MIN and MAX summarise many rows into one. GROUP BY says what "per" means in your question.

Worked example

SELECT month, SUM(amount) FROM sales GROUP BY month ORDER BY month โ€” and swapping SUM for COUNT answers a completely different question, which is why the plain-English version matters.

Your practice task

Write one query per business question: total per month, average per category, count per city, and the single worst-performing month.

Do this before moving on. Reading a solution teaches the shape of it; typing it teaches you.

Key takeaway

COUNT, SUM, AVG, MIN and MAX summarise many rows into one. GROUP BY says what "per" means in your question.

Create free account or sign in

Almost there

15 lessons left of 15

Finish every lesson to unlock the certificate. Each one ends in a practice task โ€” do them and the final project brief writes itself.

Next recommended course Interview DSA Crash Course