advanced aggregation SQL Server PostgreSQL
Aggregate Across Arbitrary Dimension Combinations With GROUPING SETS
Produce multiple independent aggregation levels in one query using `GROUPING SETS` — more flexible than `ROLLUP` because you choose exactly which combinations to include.