SQL Data Analytics • Lesson 7
Aggregate Functions
Learn how SQL turns thousands of rows into useful business numbers using COUNT, SUM, AVG, MIN and MAX.
0 of 8 concepts completed
Complete the activity and related MCQ to unlock the next concept.
What is an Aggregate Function?
An aggregate function takes many rows and produces a single result. Instead of returning every sale, SQL returns one useful number — the total, the average, the highest value, and so on.
Interactive Data
Sales table
The Sales table is used throughout the lesson so you can see every aggregate computed from the same five rows.
| id | product | category | amount |
|---|---|---|---|
| 101 | Laptop | Electronics | ₹50,000 |
| 102 | Mouse | Electronics | ₹1,200 |
| 103 | Chair | Furniture | ₹8,000 |
| 104 | Desk | Furniture | ₹15,000 |
| 105 | Keyboard | Electronics | ₹2,500 |
Learn by Seeing
Many rows → one number
SELECT COUNT(*) FROM Sales;
COUNT(*) collapses all rows into a single number: how many rows exist.
Interactive Activity
What does an aggregate function return?
Hint: Think about the difference between listing every row and summarizing them into a total.
SQL Analyst Mindset
From thousands of rows to one business number
Aggregate functions are the analyst's compression tool. Instead of staring at raw data, you produce a number a manager can act on.
Read the question
What number does the business want?
Choose the function
COUNT, SUM, AVG, MIN or MAX?
Write the query
SELECT function(column) FROM table;
Interpret
What does this number mean for the business?
Lesson Summary
What you learned
Count rows or non-NULL values.
Add numeric values together.
Calculate the arithmetic mean.
Find the smallest or largest value.
Quick revision