ソースコード
with a as (
    select
        session_id,
        process_id,
        rank() over(
            partition by session_id
            order by
                EX_TIMESTAMP
        ) rnk
    from
        PROCESS_LOG
)
select
    pid as PROCESS,
    count(tbl.process_id) as CNT
from
    (
        WITH SEQ AS (SELECT 1 as no UNION ALL SELECT no + 1 as no FROM SEQ WHERE no + 1 <= 5)
        select 'STEP' || no as 'pid' from SEQ
    ) x
    left join (
        select
            x.session_id,
            x.process_id
        from
            a x
            left join (
                select
                    *
                from
                    a
                where
                    process_id = 'STEP' || rnk
            ) y on x.session_id = y.session_id
            and x.process_id >= y.process_id
            where x.process_id = 'STEP' || x.rnk
        group by
            x.session_id,
            x.process_id
        having
            count(y.session_id) == x.rnk
    ) tbl on x.pid = tbl.process_id
group by
    pid
order by
    pid;
提出情報
提出日時2024/04/19 16:35:27
コンテスト第10回 SQLコンテスト
問題顧客行動分析
受験者orekwys
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量90 MB
メッセージ
テストケース(通過数/総数)
4/4
状態
メモリ使用量
データパターン1
AC
89 MB
データパターン2
AC
86 MB
データパターン3
AC
90 MB
データパターン4
AC
86 MB