Median Salary per Department
Hard
Advanced Queries
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.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.