select d.DEPARTMENT, a.EMP_NO, a.FIRST_NAME, a.LAST_NAME, a.SALARY
from (select DEPT_NO, EMP_NO, FIRST_NAME, LAST_NAME, SALARY, dense_rank() over (partition by DEPT_NO order by SALARY desc) as ranking
from EMPLOYEE) as a
inner join DEPARTMENT as d
on a.DEPT_NO = d.DEPT_NO
where a.ranking = 1
order by a.SALARY desc
;
SELECT 'Last_query_cost' AS "Variable_name", 0 AS "Value" FROM RDB$DATABASE;