Understanding the flaw in the query Suppose we have a relation

Employee={empId,name,department, salary}


and we are interested in finding the employees who get more salary than anyone in department 5. Would the following query work?

Select e.empId 
from employee e 
where not exists (select * from employee s where s.department = 5 and s.salary &gt;= e.salary)


Can this fail in any case? If so how?
It looks fine to me. It correctly avoids listing any employees from department five, even if there are multiple employees with the same highest salary in that department.