184. Department Highest Salary
Review usage of in
, exists
The Employee
table holds all employees. Every employee has an Id, a salary, and there is also a column for the department Id.
1 | +----+-------+--------+--------------+ |
The Department
table holds all departments of the company.
1 | +----+----------+ |
Write a SQL query to find employees who have the highest salary in each of the departments. For the above tables, Max has the highest salary in the IT department and Henry has the highest salary in the Sales department.
1 | +------------+----------+--------+ |
Soulution:
1 | -- exists |
1 | -- in |