Answered Questions

  • Creating a matrix query

    Create a matrix query to display the job, the salary for that job based on department number and the total salary for that job, for departments 20,50,80, and 90,giving each column and appropriate heading.

    sachin

    • Apr 18th, 2012

    Select job,
    sum(decode(deptno,10,sal)) deptno10,
    sum(decode(deptno,20,sal)) deptno20,
    sum(decode(deptno,30,sal)) deptno30,
    sum(decode(deptno,40,sal)) deptno40
    from emp group by job order by 1;

    Neha

    • Sep 25th, 2011

    Select job in job, sal in salary, sum(salary) in total_sal
    where job=(select job in job where deptno=20 and 50 and 80 and 90)
    ;