Understanding the flaw in the query
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.