ソースコード
SELECT PROCESS_ID AS PROCESS,
       SUM(CNT) AS CNT
  FROM (SELECT SESSION_ID, 
               PROCESS_ID,
               USER_ID,
               EX_TIMESTAMP,
               CASE
                 WHEN PROCESS_ID = 'STEP5' AND LAG(PROCESS_ID, 1) over (PARTITION BY SESSION_ID, USER_ID ORDER BY EX_TIMESTAMP) = 'STEP4' AND LAG(PROCESS_ID, 2) over (PARTITION BY SESSION_ID, USER_ID ORDER BY EX_TIMESTAMP) = 'STEP3' AND LAG(PROCESS_ID, 3) over (PARTITION BY SESSION_ID, USER_ID ORDER BY EX_TIMESTAMP) = 'STEP2' AND LAG(PROCESS_ID, 4) over (PARTITION BY SESSION_ID, USER_ID ORDER BY EX_TIMESTAMP) = 'STEP1' THEN '1'
                 WHEN PROCESS_ID = 'STEP4' AND LAG(PROCESS_ID, 1) over (PARTITION BY SESSION_ID, USER_ID ORDER BY EX_TIMESTAMP) = 'STEP3' AND LAG(PROCESS_ID, 2) over (PARTITION BY SESSION_ID, USER_ID ORDER BY EX_TIMESTAMP) = 'STEP2' AND LAG(PROCESS_ID, 3) over (PARTITION BY SESSION_ID, USER_ID ORDER BY EX_TIMESTAMP) = 'STEP1' THEN '1'
                 WHEN PROCESS_ID = 'STEP3' AND LAG(PROCESS_ID, 1) over (PARTITION BY SESSION_ID, USER_ID ORDER BY EX_TIMESTAMP) = 'STEP2' AND LAG(PROCESS_ID, 2) over (PARTITION BY SESSION_ID, USER_ID ORDER BY EX_TIMESTAMP) = 'STEP1' THEN '1'
                 WHEN PROCESS_ID = 'STEP2' AND LAG(PROCESS_ID, 1) over (PARTITION BY SESSION_ID, USER_ID ORDER BY EX_TIMESTAMP) = 'STEP1' THEN '1'
                 WHEN PROCESS_ID = 'STEP1' THEN '1'
                 ELSE '0'
               END AS CNT
          FROM PROCESS_LOG
         ORDER BY  EX_TIMESTAMP  

        )
 GROUP BY PROCESS_ID
 ORDER BY PROCESS_ID
提出情報
提出日時2023/12/19 17:14:14
コンテスト第10回 SQLコンテスト
問題顧客行動分析
受験者korogu
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量86 MB
メッセージ
テストケース(通過数/総数)
3/4
状態
メモリ使用量
データパターン1
AC
84 MB
データパターン2
AC
84 MB
データパターン3
WA
86 MB
データパターン4
AC
84 MB