https://www.nowcoder.com/practice/4bcb6a7d3e39423291d2f7bdbbff87f8?tpId=82&&tqId=29778&rp=1&ru=/ta/sql&qru=/ta/sql/question-ranking

select d.dept_no, dept_name, title, count(title)
from titles t, dept_emp d, departments p
where t.emp_no=d.emp_no and d.dept_no=p.dept_no
group by 1, 3
order by 1