Salary Quartiles with NTILE
Medium
Window Functions
Divide employees into four equal salary groups (quartile 1 = lowest salaries). Return name, salary and quartile ordered by salary.
Table schema
Employees(id INT PRIMARY KEY, name VARCHAR(50), salary INT)Sample data
name | salary
Alice | 1000
Bob | 2000
Carol | 3000
Dan | 4000
Eve | 5000
Frank | 6000
Grace | 7000
Heidi | 8000
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.