Call me foolish, but what about the following makes it undesirable? The question didn't ask about a null case of a department with no employees.
-- List employees who have the biggest salary in their departments
SELECT em.EmployeeID, em.departmentId, MAX(salary) as salary
FROM employees em
GROUP BY em.departmentId
-- List employees who have the biggest salary in their departments SELECT em.EmployeeID, em.departmentId, MAX(salary) as salary FROM employees em GROUP BY em.departmentId