SQL Practice Logo

SQLPractice Online

Scenario SQL Question

Cumulative % of Department Salary Budget

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

Problem Statement

Within each department, order employees by salary DESC and compute the cumulative salary and cumulative percentage of the department's total salary expense (rounded to 2). This shows how few top earners make up most of the cost. Return department_name, first_name, last_name, salary, cumulative_salary, cumulative_pct — ordered by department_name, salary DESC, employee_id.

Relevant Tables

employeesdepartments

SQL Concepts Used in This Scenario

Strengthen your understanding with these targeted learning topics: