select distinct dept_no,
    dept_name,
    title,
    count(emp_no) over(partition by dept_no,title) as count
from dept_emp
left join departments  using(dept_no)
left join titles using(emp_no)


需要distinct去重;否则count会在每个员工后 重复填充部门内相同岗位的数量。