SQL Practice Logo

SQLPractice Online

Scenario SQL Question

Department Salary Summary

Build mastery in Aggregations with this scenario-based SQL challenge and live execution support.

Problem Statement

For each department that has employees, return department_name, total_employees, total_salary_cost, and avg_salary (rounded to 2 decimals). Sort by total_salary_cost descending — the first row is therefore the most expensive department.

Relevant Tables

departmentsemployees

SQL Concepts Used in This Scenario

Strengthen your understanding with these targeted learning topics: