ソースコード
WITH PROCESS1 AS (
    SELECT
        SESSION_ID,
        PROCESS_ID,
        USER_ID,
        EX_TIMESTAMP,
        RANK() OVER (
            PARTITION BY SESSION_ID
            ORDER BY EX_TIMESTAMP
        ) AS TIME_ID
    FROM
        PROCESS_LOG
), PROCESS2 AS (
    SELECT
        PROCESS1.*,
        RANK() OVER (
            PARTITION BY SESSION_ID
            ORDER BY PROCESS_ID
        ) AS STEP_ID
    FROM
        PROCESS1
    WHERE
        PROCESS1.PROCESS_ID = 'STEP' || TIME_ID
), PROCESS3 AS (
    SELECT
        PROCESS2.*
    FROM
        PROCESS2
    WHERE
        PROCESS2.TIME_ID = PROCESS2.STEP_ID
)
SELECT
    PROCESS3.PROCESS_ID AS PROCESS,
    COUNT(*) AS CNT
FROM
    PROCESS3
INNER JOIN (
    SELECT
        SESSION_ID,
        MIN(STEP_ID) AS MIN_STEP_ID
    FROM
        PROCESS3
    GROUP BY
        SESSION_ID
) AS
    MIN_STEP ON
    MIN_STEP.SESSION_ID = PROCESS3.SESSION_ID AND
    MIN_STEP.MIN_STEP_ID = 1
GROUP BY
    PROCESS3.PROCESS_ID
ORDER BY
    PROCESS3.PROCESS_ID
提出情報
提出日時2023/12/17 17:41:52
コンテスト第10回 SQLコンテスト
問題顧客行動分析
受験者naoigcat
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量92 MB
メッセージ
テストケース(通過数/総数)
3/4
状態
メモリ使用量
データパターン1
AC
92 MB
データパターン2
AC
88 MB
データパターン3
AC
92 MB
データパターン4
WA
89 MB