Aggregate rows sharing common values.
Aggregates rows into groups, collapsing them to one row per group while enabling aggregate functions like COUNT and SUM. All non-aggregated SELECT columns must appear in the GROUP BY clause. Inconsistencies between SQL standards and MySQL default behavior can produce unexpected values.
| Database System | Support Status | Since Version | Notes |
|---|---|---|---|
| MySQL | ✓ Supported | all | ROLLUP extension |
| PostgreSQL | ✓ Supported | all | Standard + CUBE/ROLLUP |
| SQL Server | ✓ Supported | 2005 | Grouping sets |
| Oracle | ✓ Supported | all | Grouping sets/CUBE |
| SQLite | ✓ Supported | all | Basic only |
Combine rows with same keys for aggregation.
ROLLUP extension
Standard + CUBE/ROLLUP
Grouping sets
Grouping sets/CUBE
Basic only