ソースコード

with
  s1 as (select SESSION_ID, EX_TIMESTAMP from PROCESS_LOG where PROCESS_ID = 'STEP1')
, s2 as (select SESSION_ID, EX_TIMESTAMP from PROCESS_LOG where PROCESS_ID = 'STEP2')
, s3 as (select SESSION_ID, EX_TIMESTAMP from PROCESS_LOG where PROCESS_ID = 'STEP3')
, s4 as (select SESSION_ID, EX_TIMESTAMP from PROCESS_LOG where PROCESS_ID = 'STEP4')
, s5 as (select SESSION_ID, EX_TIMESTAMP from PROCESS_LOG where PROCESS_ID = 'STEP5')
, validated as (
  select
      s1.SESSION_ID
    , s1.EX_TIMESTAMP as STEP1
    , s2.EX_TIMESTAMP as STEP2
    , s3.EX_TIMESTAMP as STEP3
    , s4.EX_TIMESTAMP as STEP4
    , s5.EX_TIMESTAMP as STEP5
  from
    s1
    left outer join s2 on s1.SESSION_ID = s2.SESSION_ID and s1.EX_TIMESTAMP < s2.EX_TIMESTAMP
    left outer join s3 on s1.SESSION_ID = s3.SESSION_ID and s1.EX_TIMESTAMP < s3.EX_TIMESTAMP
    left outer join s4 on s1.SESSION_ID = s4.SESSION_ID and s1.EX_TIMESTAMP < s4.EX_TIMESTAMP
    left outer join s5 on s1.SESSION_ID = s5.SESSION_ID and s1.EX_TIMESTAMP < s5.EX_TIMESTAMP
)
          select 'STEP1' as PROCESS, count(*) as CNT from validated where STEP1 is not null
union all select 'STEP2' as PROCESS, count(*) as CNT from validated where STEP2 is not null
union all select 'STEP3' as PROCESS, count(*) as CNT from validated where STEP3 is not null
union all select 'STEP4' as PROCESS, count(*) as CNT from validated where STEP4 is not null
union all select 'STEP5' as PROCESS, count(*) as CNT from validated where STEP5 is not null
;
提出情報
提出日時2023/12/15 13:05:29
コンテスト第10回 SQLコンテスト
問題顧客行動分析
受験者kamaoda
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量92 MB
メッセージ
テストケース(通過数/総数)
0/4
状態
メモリ使用量
データパターン1
WA
92 MB
データパターン2
WA
88 MB
データパターン3
WA
88 MB
データパターン4
WA
84 MB