Hi so I am running the below query and and it show my the salary by department and also min and max salary. However, when I tried to use AVG to find the average salary by each DEPARTMENTS it throw me an error. I wonder if anyone has any advice how to sort that? Thanks
SELECT
E.EMPLOYEE_ID,
E.FIRST_NAME,
E.LAST_NAME,
E.SALARY,
D.DEPARTMENT_ID,
D.DEPARTMENT_NAME,
E.SALARY,
j.max_salary,
j.min_salary
-- AVG(SALARY) AS AVERAGE_SALARY
FROM EMPLOYEES E
JOIN DEPARTMENTS D
ON E.DEPARTMENT_ID = D.DEPARTMENT_ID
JOIN JOBS J
ON E.JOB_ID = J.JOB_ID
SELECT
E.EMPLOYEE_ID,
E.FIRST_NAME,
E.LAST_NAME,
E.SALARY,
D.DEPARTMENT_ID,
D.DEPARTMENT_NAME,
E.SALARY,
j.max_salary,
j.min_salary,
AVG(SALARY) AS AVERAGE_SALARY
FROM EMPLOYEES E
JOIN DEPARTMENTS D
ON E.DEPARTMENT_ID = D.DEPARTMENT_ID
JOIN JOBS J
ON E.JOB_ID = J.JOB_ID
