ソースコード
with DELETEITEM as
(
SELECT ITEM_CODE AS CODE,
        ITEM_NAME AS NAME,
       "DELETED" AS COMP_RSLT
FROM ITEM_HISTORY
EXCEPT
SELECT  ITEM_CODE AS CODE,
ITEM_NAME AS NAME,
       "DELETED"  AS COMP_RSLT
FROM ITEM
),
ADDITEM as
(
SELECT ITEM_CODE AS CODE,
ITEM_NAME AS NAME,
       "ADDED" AS COMP_RSLT 
FROM ITEM
EXCEPT
SELECT ITEM_CODE AS CODE,
ITEM_NAME AS NAME,
       "ADDED"  AS COMP_RSLT
FROM ITEM_HISTORY
),
UPDATEITEM AS
(
SELECT
i.ITEM_CODE AS CODE,
i.ITEM_NAME AS NAME,
"UPDATED" AS COMP_RSLT
FROM ITEM i
INNER JOIN ITEM_HISTORY ih ON i.ITEM_CODE  = ih.ITEM_CODE  AND i.UPDATE_USER_NAME = ih.UPDATE_USER_NAME
WHERE i.USER_UPDATE_DATETIME <> ih.USER_UPDATE_DATETIME
),
UNIONTABLE AS
(SELECT * FROM DELETEITEM
UNION
SELECT * FROM ADDITEM)
SELECT * FROM UPDATEITEM
UNION
SELECT * FROM UNIONTABLE
ORDER BY CODE DESC
提出情報
提出日時2024/04/19 16:02:28
コンテスト第12回 SQLコンテスト
問題データ操作履歴
受験者korogu
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量85 MB
メッセージ
テストケース(通過数/総数)
3/3
状態
メモリ使用量
データパターン1
AC
85 MB
データパターン2
AC
85 MB
データパターン3
AC
82 MB