ソースコード
with t as (
select SESSION_ID as s,
PROCESS_ID as p,
rank() over(
partition by session_id
order by EX_TIMESTAMP) as r
from PROCESS_LOG as x
group by session_id, process_id
), t1 as (
select *
from t
where p='STEP1' and r=1
), t2 as (
select *
from t1 inner join t
on t.s=t1.s
where t.p='STEP2' and t.r=2
), t3 as (
select *
from t2 inner join t
on t.s=t2.s
where t.p='STEP3' and t.r=3
), t4 as (
select *
from t3 inner join t
on t.s=t3.s
where t.p='STEP4' and t.r=4
), t5 as (
select *
from t4 inner join t
on t.s=t4.s
where t.p='STEP5' and t.r=5
)
select 'STEP1' as 'PROCESS',
count(*) as 'CNT'
from t1
union all
select 'STEP2' as 'PROCESS',
count(*) as 'CNT'
from t2
union all
select 'STEP3' as 'PROCESS',
count(*) as 'CNT'
from t3
union all
select 'STEP4' as 'PROCESS',
count(*) as 'CNT'
from t4
union all
select 'STEP5' as 'PROCESS',
count(*) as 'CNT'
from t5
提出情報
提出日時2023/12/18 02:05:28
コンテスト第10回 SQLコンテスト
問題顧客行動分析
受験者tabr
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量87 MB
メッセージ
テストケース(通過数/総数)
4/4
状態
メモリ使用量
データパターン1
AC
86 MB
データパターン2
AC
84 MB
データパターン3
AC
87 MB
データパターン4
AC
84 MB