Skip to main content
Aggregate data using GROUP BY with aggregate functions.

Basic Syntax

Aggregate Functions

Count by Group

Sum by Group

Average by Group

Min/Max by Group

Multiple Columns with GET WITH

For multiple columns with aggregates (except COUNT):

Group by Multiple Columns

HAVING Clause

Filter groups after aggregation.

WHERE vs HAVING

  • WHERE filters rows before grouping
  • HAVING filters groups after aggregation

With ORDER BY

Complete Example

Next Steps

Window Functions

Advanced analytics

Insert Data

Create new records