ソースコード
WITH ADDED AS (
    SELECT
        i.ITEM_CODE AS CODE,
        i.ITEM_NAME AS NAME,
        'ADDED' AS COMP_RSLT
    FROM ITEM AS i
    LEFT JOIN ITEM_HISTORY AS h
    ON i.ITEM_CODE = h.ITEM_CODE
    WHERE h.ITEM_CODE IS NULL
),
DELETED AS (
    SELECT
        h.ITEM_CODE AS CODE,
        h.ITEM_NAME AS NAME,
        'DELETED' AS COMP_RSLT
    FROM ITEM_HISTORY AS h
    LEFT JOIN ITEM AS i
    ON h.ITEM_CODE = i.ITEM_CODE
    WHERE i.ITEM_CODE IS NULL
),
UPDATED AS (
    SELECT
        i.ITEM_CODE AS CODE,
        i.ITEM_NAME AS NAME,
        'UPDATED' AS COMP_RSLT
    FROM ITEM AS i
    INNER JOIN ITEM_HISTORY AS h
    ON i.ITEM_CODE = h.ITEM_CODE
    WHERE i.USER_UPDATE_DATETIME != h.USER_UPDATE_DATETIME
)
SELECT * FROM ADDED
UNION ALL
SELECT * FROM DELETED
UNION ALL
SELECT * FROM UPDATED
ORDER BY CODE DESC
提出情報
提出日時2024/05/06 21:53:44
コンテスト第12回 SQLコンテスト
問題データ操作履歴
受験者yoichi22
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量84 MB
メッセージ
テストケース(通過数/総数)
3/3
状態
メモリ使用量
データパターン1
AC
84 MB
データパターン2
AC
84 MB
データパターン3
AC
84 MB