Scenario SQL Question
Salary Quartiles Per Department (NTILE)
Build mastery in Ctes Window with this scenario-based SQL challenge and live execution support.
Problem Statement
Divide employees into 4 salary quartiles within each department (NTILE(4), ascending salary). Label them Q1–Q4. Return department_name, first_name, last_name, salary, salary_quartile — ordered by department_name, salary, employee_id.
Relevant Tables
employeesdepartments
SQL Concepts Used in This Scenario
Strengthen your understanding with these targeted learning topics: