ソースコード
with
 additem as	(select ITEM_CODE,item_name,'ADDED' as COMP_RSLT from ITEM where 
  not EXISTS (
  SELECT 1
  FROM ITEM_HISTORY where item.item_code=item_history.item_code
    )
)
,
 delitem as	(select  ITEM_CODE,item_name,'DELETED' as COMP_RSLT from ITEM_HISTORY where 
  not EXISTS (
  SELECT 1
  FROM ITEM where item.item_code=item_history.item_code
    )
)
,
 upditem as	(select i.ITEM_CODE,i.item_name,'UPDATED' as COMP_RSLT from ITEM i,ITEM_HISTORY h where i.USER_UPDATE_DATETIME <> h.USER_UPDATE_DATETIME and i.ITEM_CODE = h.ITEM_CODE
)
select 
ITEM_CODE as CODE
,ITEM_NAME as NAME
,COMP_RSLT
from
(
SELECT * FROM additem
union SELECT * FROM delitem
union SELECT * FROM upditem)
order by code desc
提出情報
提出日時2024/04/22 11:35:02
コンテスト第12回 SQLコンテスト
問題データ操作履歴
受験者nasu_mi
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量100 MB
メッセージ
テストケース(通過数/総数)
3/3
状態
メモリ使用量
データパターン1
AC
100 MB
データパターン2
AC
84 MB
データパターン3
AC
84 MB