-- There are tables with structure
Employee
id (PK)
name
salary
dep_id (FK department.id)
Department
id (PK)
name
-- write a query that returns a list of all department names with the maximum salary in each department
SELECT d.name, MAX(e.salary) AS max_salary
FROM Department d
JOIN Employee e ON e.dep_id = d.id
GROUP BY d.id
Employee
id | name | salary | dep_id
1 | Ivanov | 90 | 1
2 | Petrov | 150 | 2
3 | Sidorov| 110 | 1
4 | Kuznetsov| 150 | 2
5 | Sokolov| 80 | 2
Department
id | name
1 | AHO
2 | IT
3 | Accounting