方法)连结salaries & dept_manager
SELECT dm.emp_no, s.salary, s.from_date, s.to_date, dm.dept_no FROM salaries AS s JOIN dept_manager AS dm -- 表连结 ON s.emp_no = dm.emp_no WHERE dm.to_date ='9999-01-01' -- 限制条件(当前) AND s.to_date ='9999-01-01' ORDER BY s.emp_no ASC;解题要点:
- 题目限制条件 -- 当前(dept_manager.to_date='9999-01-01')领导 & 当前(salaries.to_date='9999-01-01')薪水详情
-
WHERE dm.to_date ='9999-01-01' AND s.to_date ='9999-01-01'
- 联立条件ON
ON s.emp_no = dm.emp_no