How can we aggregate metrics broken down by category or department?
GROUP BY partitions rows into groups having the same values in specified columns.
Departmental headcount, sales by region, daily active users, orders by country.
SELECT department,
COUNT(*) AS employee_count
FROM employees
GROUP BY department;Practice typing production-grade SQL code for GROUP BY.