题解 | #统计各个部门的工资记录数#
统计各个部门的工资记录数
https://www.nowcoder.com/practice/6a62b6c0a7324350a6d9959fa7c21db3
select t1.dept_no, t1.dept_name, count(*) as sum from (select dept_no, dept_name from departments) as t1 left join (select emp_no, dept_no from dept_emp)as t2 on t1.dept_no = t2.dept_no left join (select salary, emp_no from salaries) as t3 on t3.emp_no = t2.emp_no group by t1.dept_no,t1.dept_name
主打一个使劲连