这道题还是比较有意思的 简单的构建两个表 分别为 员工工资表和经理工资表 并且同时salaries.emp_no = '9999-01-01' 即可
SELECT a.emp_no, b.emp_no, a.salary, b.salary
FROM (SELECT de.emp_no, s.salary, de.to_date, de.dept_no
FROM dept_emp de JOIN salaries s
ON de.emp_no = s.emp_no
AND s.to_date = '9999-01-01') AS a
JOIN (SELECT dm.emp_no, s.salary, dm.dept_no
FROM dept_manager dm JOIN salaries s
ON dm.emp_no = s.emp_no
AND s.to_date = '9999-01-01') AS b
ON a.salary > b.salary
AND a.dept_no = b.dept_no