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

Median Salary per Department

Return the median salary of each department (the average of the two middle values for an even count), rounded to one decimal. Order by department_id.

Table schema

Employees(id INT PRIMARY KEY, department_id INT, salary INT)

Sample data

id | department_id | salary
1 | 1 | 100
2 | 1 | 200
3 | 1 | 300
4 | 2 | 10
5 | 2 | 20

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.