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

Join Shalyam Newsletter

Get exclusive insights with every issue: education, research and innovation news.

One email a week. Unsubscribe any time.