Last answered:

29 Jan 2024

Posted on:

25 Jan 2024

0

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)
Instructor
Posted on:

29 Jan 2024

0

Hi Kareem!
Thanks for reaching out.


You're absolutely right! Thanks for sharing this piece of information with the Community!


Best,
Tsvetelin

Submit an answer