In the video lesson of the link provided, I think there is a mistake:
At 1:33 it is suggested to select from_date from t_dept_emp table.
However, in the solution of the problem, the right choice was to select from_date from t_salaries table.
I wanted to confirm if the answer were going to be different, and they actually are.
Please correct me if I am wrong, but If I am not, then why we cannot select from_date from t_dept_emp table?
Thank you so much once again!
This is my code:
ROUND(AVG(s.salary), 2) AS average_salary,
YEAR(de.from_date) AS calendar_year
t_salaries s ON e.emp_no = s.emp_no
t_dept_emp de ON s.emp_no = de.emp_no
t_departments d ON de.dept_no = d.dept_no
YEAR(de.from_date) <= 2002
GROUP BY d.dept_name , e.gender , YEAR(de.from_date)
ORDER BY d.dept_name;
Great to have you in the course and thanks for reaching out!
The tasks requires from us to compare the salaries of certain individuals in the entire company. That’s why the only way in which we can obtain the correct output is by using the start date from the salaries table.
Hope this helps.
It helps! Thank you.
You are very welcome!