题解 | #统计各个部门的工资记录数#
统计各个部门的工资记录数
https://www.nowcoder.com/practice/6a62b6c0a7324350a6d9959fa7c21db3
SELECT D.dept_no, D.dept_name, COUNT(S.salary) AS sum FROM salaries AS S LEFT JOIN dept_emp AS DE ON DE.emp_no = S.emp_no LEFT JOIN departments AS D ON D.dept_no = DE.dept_no GROUP BY D.dept_no ORDER BY D.dept_no