Joining through dept_emp instead of dept_manager
Why does joining through dept_emp give a different result?
Does that mean dept_emp has null values that aren't in dept_manager?
1 answers ( 0 marked as helpful)
Hi Christopher!
Thanks for reaching out.
This is because the dept_emp table has more records. The idea is to use the dept_manager table because it contains records only for managers, whereas the dept_emp table contains records for both employees and managers. Also, you should use the GROUP BY clause to obtain the average salary for each department.
Hope this helps.
Best,
Tsvetelin