I have a table EmpDetails:
EmpDetails
DeptID EmpName Salary Engg Sam 1000 Engg Smith 2000 HR Denis 1500 HR
SELECT Employee_ID , First_name , last_name , department_id , Salary FROM (SELECT Employee_ID , First_name , last_name , department_id , Salary , MAX(salary) OVER (PARTITION BY department_id) dept_max_sal FROM EMPLOYEES) AS Emp WHERE salary = dept_max_sal;