ソースコード
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 SESSION_ID,
                  EX_TIMESTAMP   
        )
 GROUP BY PROCESS_ID
 ORDER BY PROCESS_ID
提出情報
提出日時2023/12/19 15:24:27
コンテスト第10回 SQLコンテスト
問題顧客行動分析
受験者test
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量85 MB
メッセージ
テストケース(通過数/総数)
3/4
状態
メモリ使用量
データパターン1
AC
84 MB
データパターン2
AC
84 MB
データパターン3
WA
85 MB
データパターン4
AC
84 MB