L2 Q5
Intermediate Level
Practice Question
Level 2 - Question 5: Get Max Salary per Department
Scenario
A manager wants to know the highest-paid employee in each department.
Task
Write a SQL query to return department and the maximum salary in each department using GROUP BY.
Sample Schema: employees
| emp_id | employee_name | department | salary |
|---|---|---|---|
| 101 | Rafi | IT | 8900 |
| 102 | Sara | Sales | 7600 |
| 103 | Kabir | IT | 9100 |