Back to search

What does GROUP BY do?

GROUP BY collects rows by one or more columns so aggregate functions can run per group.

SQL Easy Theory

What does GROUP BY do?

GROUP BY collects rows by one or more columns so aggregate functions can run per group.

  • Works with count sum avg
  • Every selected non-aggregate column must be grouped
  • HAVING filters groups

What does GROUP BY do?