Maximum salary of employee in specific department

Viewed 966
EmpID   EmpName EmpSalary   EmpDept
1       Steve    5000       HR
2       Robert   5000       Management
3       Brad     3000       HR
4       Sam      4000       HR
5       Dave     2000       Management
6       Stuvart  4500       Management

How to get employee details from the EMPLOYEE table whose salary is max and he is belong to HR department... My query is

SELECT EmpID,EmpName,EmpSalary,EmpDept 
FROM EMPLOYEE 
WHERE EmpSalary IN (select max(EmpSalary) from EMPLOYEE) 
AND EMPDEPT='HR'

I tried above query, it is giving me the accurate result, but due to performance issue I can not use inner queries.

5 Answers
Related