I'm triyng to list all department id and name, + number of managers per department without duplication. Could you check these right or wrong and tell me where should I fix? Thank you for reading.
Below is the image of my work ,
Here are queries I used (inside image but just in case)
select departments.dept_no as department_ID,
departments.dept_name as department_Name,
dept_manager.emp_no, count(distinct dept_manager.emp_no) as Numbers_of_Managers
from departments
inner join dept_manager on dept_manager.dept_no=departments.dept_no
group by dept_manager.dept_no;
You shouldn't have dept_manager.emp_no
in the SELECT
list. The assignment doesn't ask for it, and you're just selecting one random manager out of the group.
Other than that, it's fine.