SQL TUTORIAL • LESSON 13, Aggregating Data
Introduction to data aggregation
In In the ‘Creating columns’ section of the tutorial, you went from simply selecting existing data in your data set to creating new columns in your table.
Now, you’ll learn how to work with rows.
In SQL, each row is one individual observation — for example, one order or one customer. New rows usually come directly from your data source (like your database), not from your query.
But there’s a way to create new rows in your result by grouping and summarizing existing rows. This is called aggregation.
Common examples of this include:
- Counting how many customers you have
- Summarizing total sales
- Finding the average order size
Aggregation lets you take lots of rows and combine them into useful summaries — helping you see the big picture in your data.