ソースコード
with PLOG as (
select
	 SESSION_ID
	,PROCESS_ID
	,EX_TIMESTAMP
	,row_number() over (partition by SESSION_ID order by EX_TIMESTAMP) as t_num
from PROCESS_LOG
)
, PLOG1 as (
select
	 SESSION_ID
	,PROCESS_ID
	,row_number() over (partition by SESSION_ID order by EX_TIMESTAMP) as t_num
from PLOG
where PROCESS_ID = 'STEP1' and t_num = 1
)
, PLOG2 as (
select
	 PLOG.SESSION_ID
	,PLOG.PROCESS_ID
	,row_number() over (partition by PLOG.SESSION_ID order by PLOG.EX_TIMESTAMP) as t_num
from PLOG
	 inner join PLOG1 PLOGN
	 on  PLOG.SESSION_ID = PLOGN.SESSION_ID
where PLOG.PROCESS_ID = 'STEP2' and PLOG.t_num = 2
)
, PLOG3 as (
select
	 PLOG.SESSION_ID
	,PLOG.PROCESS_ID
	,row_number() over (partition by PLOG.SESSION_ID order by PLOG.EX_TIMESTAMP) as t_num
from PLOG
	 inner join PLOG2 PLOGN
	 on  PLOG.SESSION_ID = PLOGN.SESSION_ID
where PLOG.PROCESS_ID = 'STEP3' and PLOG.t_num = 3
)
, PLOG4 as (
select
	 PLOG.SESSION_ID
	,PLOG.PROCESS_ID
	,row_number() over (partition by PLOG.SESSION_ID order by PLOG.EX_TIMESTAMP) as t_num
from PLOG
	 inner join PLOG3 PLOGN
	 on  PLOG.SESSION_ID = PLOGN.SESSION_ID
where PLOG.PROCESS_ID = 'STEP4' and PLOG.t_num = 4
)
, PLOG5 as (
select
	 PLOG.SESSION_ID
	,PLOG.PROCESS_ID
	,row_number() over (partition by PLOG.SESSION_ID order by PLOG.EX_TIMESTAMP) as t_num
from PLOG
	 inner join PLOG4 PLOGN
	 on  PLOG.SESSION_ID = PLOGN.SESSION_ID
where PLOG.PROCESS_ID = 'STEP5' and PLOG.t_num = 5
)
select
    PROCESS_ID, count(*)
from PLOG1
union
select
    PROCESS_ID, count(*)
from PLOG2
union
select
    PROCESS_ID, count(*)
from PLOG3
union
select
    PROCESS_ID, count(*)
from PLOG4
union
select
    PROCESS_ID, count(*)
from PLOG5
order by PROCESS_ID
	
提出情報
提出日時2023/12/18 17:13:38
コンテスト第10回 SQLコンテスト
問題顧客行動分析
受験者ckoga
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量87 MB
メッセージ
テストケース(通過数/総数)
0/4
状態
メモリ使用量
データパターン1
WA
85 MB
データパターン2
WA
84 MB
データパターン3
WA
87 MB
データパターン4
WA
85 MB