ソースコード
WITH UPD AS (
    SELECT
    	ITEM.ITEM_CODE AS CODE
        , ITEM.ITEM_NAME AS NAME
        , 'UPDATED' AS COMP_RSLT
    FROM
    	ITEM
    LEFT JOIN
        ITEM_HISTORY
    ON ITEM.ITEM_CODE = ITEM_HISTORY.ITEM_CODE
    AND ITEM.USER_UPDATE_DATETIME <> ITEM_HISTORY.USER_UPDATE_DATETIME
)
, ADDED AS (
    SELECT 
        ITEM_CODE AS CODE
        , ITEM_NAME AS NAME
        , 'ADDED' AS COMP_RSLT
    FROM
         ITEM_HISTORY
    WHERE
        NOT EXISTS (SELECT ITEM_CODE FROM ITEM
                    WHERE  ITEM.ITEM_CODE = ITEM_HISTORY.ITEM_CODE)
)
, DLT AS(
    SELECT 
        ITEM_CODE AS CODE
        , ITEM_NAME AS NAME
        , 'DELETED' AS COMP_RSLT
    FROM
         ITEM
    WHERE
        NOT EXISTS (SELECT ITEM_CODE FROM ITEM_HISTORY
                    WHERE  ITEM.ITEM_CODE = ITEM_CODE)
)
SELECT * FROM UPD
UNION ALL
SELECT * FROM ADDED
UNION ALL
SELECT * FROM DLT
ORDER BY CODE;
提出情報
提出日時2024/04/19 16:19:13
コンテスト第12回 SQLコンテスト
問題データ操作履歴
受験者doraemon
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量85 MB
メッセージ
テストケース(通過数/総数)
0/3
状態
メモリ使用量
データパターン1
WA
85 MB
データパターン2
WA
85 MB
データパターン3
WA
85 MB