User Tools

Site Tools


kurs:fragen_dezember_2018

pivot dynamisch

WITH
   T
AS
(
   SELECT
      department_id,
      JOB_id,
      salary
   FROM
      employees
   where job_id in (
      'ST_CLERK', 'SH_CLERK'
   )
)
SELECT
   *
FROM
   T
PIVOT
(
   MIN(SALary) AS MINSAL,
   MAX(SALary) AS MAXSAL
FOR
   (JOB_ID)
   in
   (  'ST_CLERK', 'SH_CLERK')
)
ORDER BY
   department_id
select * from (select employee_id,
                      job_id,
                      to_char(hire_date, 'YYYYQ') quartal
               from employees
              )
pivot (count(employee_id)
       for quartal in ('20071' "2007 Q1",
                       '20072' "2007 Q2",
                       '20073' "2007 Q3",
                       '20074' "2007 Q4"
                       )
       )
select department_id, listagg(last_name, ', ') within group (order by job_id desc ) a from employees group by department_id;

sql scripts automatisch ausführen

zeitliche Nachverfolgung von Änderungen

zustand der session

kurs/fragen_dezember_2018.txt · Last modified: 2018/12/18 13:32 by admin