1.查员工工资
2.查经理工资
3.相同部门,员工薪水大于经理薪水
SELECT E.emp_no,M.manager_no,E.emp_salary,M.manager_salary
FROM
(SELECT de.dept_no,de.emp_no, s.salary emp_salary
FROM dept_emp de
INNER JOIN dept_manager dm on de.dept_no=dm.dept_no
INNER JOIN salaries s on de.emp_no=s.emp_no
WHERE de.emp_no!=dm.emp_no AND s.to_date = '9999-01-01') E,
(SELECT dm.dept_no,dm.emp_no manager_no,s.salary manager_salary
FROM dept_manager dm
INNER JOIN salaries s on dm.emp_no=s.emp_no
WHERE s.to_date = '9999-01-01') M
WHERE E.dept_no=M.dept_no and E.emp_salary>M.manager_salary;