ソースコード
with update_table as (
select 
a.item_code as CODE,
a.item_name as NAME,
'UPDATE' as COMP_RSLT
from
item a
inner join item_history b
on a.item_code = b.item_code
where 
a.item_code = b.item_code
and a.user_update_datetime > b.user_update_datetime
)
,delete_table as (
select 
a.item_code as CODE,
a.item_name as NAME,
'DELETE' as COMP_RSLT
from
item_history a
left outer join item b
on a.item_code = b.item_code
where b.item_code is null

)
,add_table as (
select 
a.item_code as CODE,
a.item_name as NAME,
'ADDED' as COMP_RSLT
from
item a
left join item_history b
on a.item_code = b.item_code
where 
 b.item_code is null
)
select CODE, NAME, COMP_RSLT from update_table
union all
select CODE, NAME, COMP_RSLT from add_table
union all
select CODE, NAME, COMP_RSLT from delete_table
order by CODE desc
;
提出情報
提出日時2024/04/24 15:11:24
コンテスト第12回 SQLコンテスト
問題データ操作履歴
受験者masashi_sql
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量84 MB
メッセージ
テストケース(通過数/総数)
1/3
状態
メモリ使用量
データパターン1
WA
84 MB
データパターン2
AC
84 MB
データパターン3
WA
83 MB