Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

Salary Quartiles with NTILE

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.

Rewards · v2.1

Get Exclusive Insights with Every Issue

Join Shalyam Newsletter

Stay ahead in education, research, and innovation—straight to your inbox.