Aggregates and Grouping
Part of the MySQL course
Somebody asks how the EU region did last quarter. They do not want four thousand rows, they want one number, and if you fetch all four thousand rows into application code and add them up there, you have written a slow and fragile version of something the database does natively in a few milliseconds.
Every query so far returned one output row per input row. Aggregates flip that: they collapse many rows into a single value. Add GROUP BY and you get one such value per bucket instead of one for the whole table, which is where reports come from. ...
Want to learn MySQL Aggregates and Grouping in a real environment?
Click below, get a fresh Linux box with MySQL ready to go, and work through Aggregates and Grouping hands-on with an AI tutor that knows your code.
Start this lessonAggregates and GroupingWhat you'll learn
- COUNT
- SUM
- AVG
- MIN and MAX
- GROUP BY
- HAVING
- GROUP_CONCAT
- ONLY_FULL_GROUP_BY
Read this lesson in your language
All lessons in this course
13 lessons- 1What is MySQL20 min
- 2The mysql CLI and First Commands25 min
- 3Creating Databases and Tables30 min
- 4Data Types30 min
- 5SELECT and WHERE30 min
- 6Joins35 min
- 7Aggregates and Grouping30 min
- 8Indexes30 min
- 9Transactions and Storage Engines35 min
- 10Stored Procedures and Triggers35 min
- 11EXPLAIN and Query Tuning35 min
- 12mysqldump and Restore25 min
- 13Capstone: Design an Ecommerce Schema50 min
