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