Interview Guides
You are given two PostgreSQL tables from a Copeland monitoring workflow: sites and alerts. Write an SQL query that joins the tables and returns one row per site with the total number of alerts and the average alert severity. Include only active sites, and sort the result by total alerts descending, then by site name ascending.