题解 | #删除emp_no重复的记录,只保留最小的id对应的记录。#
统计各个部门的工资记录数
http://www.nowcoder.com/practice/6a62b6c0a7324350a6d9959fa7c21db3
连表查询
select d.dept_no,d.dept_name,count(s.salary) from departments d left join (select ss.salary, de.dept_no from dept_emp de join salaries ss on de.emp_no=ss.emp_no ) s on d.dept_no=s.dept_no group by d.dept_no order by d.dept_no