How can we perform multi-metric aggregation and filter groups by averages?
Combining multiple aggregate metrics with GROUP BY and HAVING produces rich analytical summaries.
Filtering departments with high average salaries or stores with high average basket sizes.
SELECT department,
COUNT(*) AS employee_count,
AVG(salary) AS average_salary
FROM employees
GROUP BY department
HAVING AVG(salary) > 50000;Practice typing production-grade SQL code for Aggregate Queries.