Filtering answers questions about individual rows. Aggregation answers questions about collections of rows: totals, averages, ranges, and counts. This chapter introduces aggregate functions, GROUP BY, HAVING, and the important differences between COUNT(*) and counting a column.
Examples use broadly supported SQL. Schema details such as indexes and enum types vary by database; those cases are labeled. Grouped results have no guaranteed display order unless the query includes ORDER BY.