Often, individual data rows are less informative than summarized information derived from them. After retrieving, filtering, and sorting data, the next step frequently involves calculating summary statistics across groups of rows. This chapter introduces SQL aggregate functions, the tools used to perform these calculations.
You will learn how to:
COUNT
, SUM
, AVG
, MIN
, and MAX
to calculate totals, averages, and find boundary values within your data.GROUP BY
clause, allowing aggregates to be calculated for each distinct group. For example, calculating the average order value AVG(order_total) per customer.HAVING
clause, which operates after the aggregation has occurred.4.1 Introduction to Aggregate Functions
4.2 Counting Rows with COUNT
4.3 Calculating Sums with SUM
4.4 Calculating Averages with AVG
4.5 Finding Minimum and Maximum Values with MIN/MAX
4.6 Grouping Data with GROUP BY
4.7 Filtering Groups with HAVING
4.8 Hands-on Practical: Aggregation and Grouping
© 2025 ApX Machine Learning