Skip to main content

GROUP BY & HAVING in SELECT

Learn GROUP BY & HAVING in SELECT (SELECT Queries, MySQL) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Introduction GROUP BY collapses rows that share the same values in the listed columns into one row per group, so aggregates (COUNT, SUM, AVG, MIN, MAX) are computed per group. HAVING filters those groups after aggregation, the way WHERE filters rows before it.

More lessons in SELECT Queries