Feedback...plase :)
CREATE TABLE new_table
(
SELECT t1.first_name, t1.last_name, round(avg(salary),1) AS average_salary, round(sum(salary),1) AS totall_salary, t4.dept_name
FROM (((employees t1
JOIN salaries t2 ON t1.emp_no = t2.emp_no)
JOIN dept_emp t3 ON t1.emp_no = t3.emp_no)
JOIN departments t4 ON t4.dept_no = t3.dept_no)
GROUP BY t1.emp_no
ORDER BY totall_salary
); # rock n' roll!
(
SELECT t1.first_name, t1.last_name, round(avg(salary),1) AS average_salary, round(sum(salary),1) AS totall_salary, t4.dept_name
FROM (((employees t1
JOIN salaries t2 ON t1.emp_no = t2.emp_no)
JOIN dept_emp t3 ON t1.emp_no = t3.emp_no)
JOIN departments t4 ON t4.dept_no = t3.dept_no)
GROUP BY t1.emp_no
ORDER BY totall_salary
); # rock n' roll!
1 answers ( 0 marked as helpful)
Hi Luigi!
Thanks for reaching out!
This query looks great to me! There's nothing that really needs to be changed in it, provided that it replies to your initial task.
Best,
Martin
Martin