Last answered:

15 Mar 2024

Posted on:

12 Mar 2024

0

last group by incomplete

in the last group by where the code reads "group by de2.emp_no,d.dept_name" should it not include s2.salary? so shouldn't it read "group by de2.emp_no,d.dept_name,s2.salary" since these are the non-aggregate field items in the main outer query? is there a reason s2.salary was excluded?

1 answers ( 0 marked as helpful)
Instructor
Posted on:

15 Mar 2024

0

Hi Nana!

Thank you for reaching out!

We are partitioning by group number and that sets the data subsets on which the average value will be taken. Even if you add s2.salary as another criteria in the GROUP BY clause, the output will remain the same (because we don't have multiple departments bearing the same name, so there's no way in which data will be grouped by different salary values for the same department).

Hope this helps.

Kind regards,
Martin

Submit an answer