SQL 2023 · Aggregation and window functions
Group and total
Compute a value per group.
SELECT status, COUNT(*) AS n, SUM(total) AS revenue FROM orders GROUP BY status;
Official SQL 2023 documentation
More aggregation and window functions commands
- Count rows
- Filter groups
- Number rows within groups
- Compute a running total
- Rank rows
- Compare with the previous row
All aggregation and window functions commands · SQL 2023 cheatsheet