SELECT   department_id, job_id, manager_id 

      , SUM(salary)

      , grouping(department_id) as grp_d

      , grouping(job_id) as grp_j

      , grouping(manager_id) as grp_m

FROM     employees

GROUP BY department_id, --> department_id  --> 1개

        ROLLUP(job_id), --> job_id, ()   --> 2개 => 1*2*2=4개의 group by 절이 생성된다고 생각

        CUBE(manager_id); --> manager_id, () --> 2개


  ==> GROUP BY department_id, job_id, manager_id

      + GROUP BY department_id, job_id, () ==> department_id, job_id

      + GROUP BY department_id, (), manager_id ==> department_id, manager_id

      + GROUP BY department_id, (), () ==> department_id



+ Recent posts