...below, we take the employee name (ename) and the department number (deptno) and display the salary of the employee by their department.
SELECT * FROM
(SELECT
ename,
sum(decode(deptno,10,sal)) DEPT10,
sum(decode(deptno,20,sal)) DEPT20,
sum(decode(deptno,30,sal)) DEPT30...