24. Department Maximum Salary

Easy

employees(employee_id, department_id, salary)

Return each department with its highest salary, as department_id and max_salary, ordered by department_id.

Tables

employees

employee_id  department_id  salary
-----------  -------------  ---------
1            10             90000.00
2            10             120000.00
3            10             120000.00
4            20             75000.00
5            30             50000.00
6            30             65000.00

Expected result

department_id  max_salary
-------------  ----------
10             120000.00
20             75000.00
30             65000.00

Sign in to write and run your own code.

Write one SELECT query