select b.dept_no,b.dept_name,count(c.salary)as sum from dept_emp as a inner join departments as b on a.dept_no=b.dept_no inner join salaries as c on c.emp_no=a.emp_no group by b.dept_no order by b.dept_no