Another solution for AVG salaries
you can also use Right Join with the dept_manager because we need all the managers anyway
Code:
SELECT
d.dept_name, avg(salary) as average_salary
FROM
departments d
right JOIN
dept_manager dm on d.dept_no = dm.dept_no
join
salaries s on s.emp_no = dm.emp_no
group by d.dept_name
order by average_salary desc
;
1 answers ( 0 marked as helpful)
Hi Kareem!
Thanks for reaching out.
You're absolutely right! Thanks for sharing this piece of information with the Community!
Best,
Tsvetelin