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.

Your progress0%

0 of 8 concepts completed

Complete the activity and related MCQ to unlock the next concept.

Concept 1AGGREGATE

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.

5
ROWS
₹76,700
TOTAL
₹15,340
AVERAGE
idproductcategoryamount
101LaptopElectronics₹50,000
102MouseElectronics₹1,200
103ChairFurniture₹8,000
104DeskFurniture₹15,000
105KeyboardElectronics₹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.

01

Read the question

What number does the business want?

02

Choose the function

COUNT, SUM, AVG, MIN or MAX?

03

Write the query

SELECT function(column) FROM table;

04

Interpret

What does this number mean for the business?

Lesson Summary

What you learned

COUNT

Count rows or non-NULL values.

SUM

Add numeric values together.

AVG

Calculate the arithmetic mean.

MIN / MAX

Find the smallest or largest value.

Quick revision

Frequently Asked Questions