SQL Practice Logo

SQLPractice Online

Scenario SQL Question

Salary Percentiles by Department

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

Problem Statement

For each department with employees, return department_name, employee_count, min_salary, max_salary, salary_range (max − min), and avg_salary (rounded to 2 decimals). Sort by avg_salary descending.

Relevant Tables

departmentsemployees

SQL Concepts Used in This Scenario

Strengthen your understanding with these targeted learning topics: