SQL Practice Logo

SQLPractice Online

Scenario SQL Question

NTILE for Quartile Distribution

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

Problem Statement

Divide employees into 4 salary quartiles (Q1-Q4) within each department. Show department name, employee name, salary, and quartile. Then count employees in each quartile per department.

Relevant Tables

employeesdepartments