I need help creating a table using the pivot clause to include the average salary of each Division_ID and use Division_ID as a Row and Job_ID as Column using data in employees2 table.
Here is my query
SELECT *
FROM (
SELECT JOB_ID, DIVISION_ID, SALARY
FROM employees2
WHERE DIVISION_ID IN (1, 2, 3, 4, 5)
)
PIVOT (
AVG(SALARY) FOR JOB_ID IN (1 AS ENG, 2 AS MGR, 3 AS PRE, 4 AS WOR, 5 AS TEC)
)
ORDER BY DIVISION _ID;
I get the following error when I try to execute the statement
ORA-00933: SQL command not properly ended
00933. 00000 - "SQL command not properly ended"
*Cause:
*Action:
Error at Line: 6 Column: 3
Here is the data that is in employees2 table (note their are only 5 JOB_IDs)
Finally, here is an example of how my result should look like