SELECT de.dept_no, d.dept_name, t.title, count(t.title) FROM dept_emp de LEFT JOIN departments d on de.dept_no = d.dept_no LEFT JOIN titles t on t.emp_no = de.emp_no GROUP BY de.dept_no,d.dept_name,t.title ORDER BY de.dept_no
SELECT de.dept_no, d.dept_name, t.title, count(t.title) FROM dept_emp de LEFT JOIN departments d on de.dept_no = d.dept_no LEFT JOIN titles t on t.emp_no = de.emp_no GROUP BY de.dept_no,d.dept_name,t.title ORDER BY de.dept_no