题解 | #查找当前薪水详情以及部门编号dept_no#
查找当前薪水详情以及部门编号dept_no
http://www.nowcoder.com/practice/c63c5b54d86e4c6d880e4834bfd70c3b
考点:group by/join
- max:为了print out 1 record
- is not null:为了exclude null values that came out from "left join"
select sa.emp_no, max(sa.salary), sa.from_date, sa.to_date, dept.dept_no
from salaries sa
left join dept_manager dept
on sa.emp_no = dept.emp_no
where dept.dept_no is not NULL
group by dept.dept_no
order by sa.emp_no , sa.salary asc