ソースコード
with tmp as(
select SESSION_ID,PROCESS_ID,
case PROCESS_ID when 'STEP1' then 1
                when 'STEP2' then 2
                when 'STEP3' then 3
                when 'STEP4' then 4
                when 'STEP5' then 5 end as Step,
Row_Number() over(partition by SESSION_ID order by EX_TIMESTAMP) as rn
  from PROCESS_LOG),
rec(SESSION_ID,PROCESS_ID,Step,rn) as(
select SESSION_ID,PROCESS_ID,Step,rn
  from tmp
 where Step = 1 and rn = 1
union all
select b.SESSION_ID,b.PROCESS_ID,b.Step,b.rn
  from rec a
  Join tmp b
    on b.SESSION_ID = a.SESSION_ID
   and b.Step = a.Step+1
   and b.rn = a.rn+1)
select 'STEP1' as PROCESS,(select count(*) from rec where PROCESS_ID = 'STEP1') as CNT union all
select 'STEP2' as PROCESS,(select count(*) from rec where PROCESS_ID = 'STEP2') as CNT union all
select 'STEP3' as PROCESS,(select count(*) from rec where PROCESS_ID = 'STEP3') as CNT union all
select 'STEP4' as PROCESS,(select count(*) from rec where PROCESS_ID = 'STEP4') as CNT union all
select 'STEP5' as PROCESS,(select count(*) from rec where PROCESS_ID = 'STEP5') as CNT
提出情報
提出日時2023/12/17 13:45:05
コンテスト第10回 SQLコンテスト
問題顧客行動分析
受験者AketiJyuuzou
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量92 MB
メッセージ
テストケース(通過数/総数)
4/4
状態
メモリ使用量
データパターン1
AC
92 MB
データパターン2
AC
87 MB
データパターン3
AC
85 MB
データパターン4
AC
91 MB