About the “Departmental Salary Compression & Range Spread” SQL Problem
Business Scenario
Executive leadership and the HR Compensation Board are conducting an annual pay equity audit to identify departments with extreme wage inequality or salary compression.
Expected Output & Criteria
Department compensation metrics including min, max, avg, and wage spread, sorted by spread descending.
Database Table Schema (PostgreSQL DDL)
PostgreSQL 16 WASMThis challenge executes directly against the following relational schema in your browser:
CREATE TABLE payroll_records (
emp_id INT PRIMARY KEY,
full_name VARCHAR(100) NOT NULL,
department VARCHAR(50) NOT NULL,
base_salary NUMERIC(10, 2) NOT NULL
);Target SQL Clauses & Operators
GROUP BYMINMAXAVGROUND
Want more Aggregations practice?
Explore the full syllabus of 12 exercises, syntax guides, and interview pitfalls.