ソースコード
WITH A AS (
    SELECT ITEM_CODE, ITEM_NAME FROM ITEM WHERE ITEM_CODE NOT IN (SELECT ITEM_CODE FROM ITEM_HISTORY)
), D AS (
    SELECT ITEM_CODE, ITEM_NAME FROM ITEM_HISTORY WHERE ITEM_CODE NOT IN (SELECT ITEM_CODE FROM ITEM)
), U AS (
    SELECT I.ITEM_CODE, I.ITEM_NAME 
    FROM ITEM I
    JOIN ITEM_HISTORY H ON I.ITEM_CODE = H.ITEM_CODE
    WHERE I.USER_UPDATE_DATETIME <> H.USER_UPDATE_DATETIME
), T AS (
    SELECT ITEM_CODE as CODE, ITEM_NAME as NAME, 'ADDED' COMP_RSLT FROM A
    UNION SELECT ITEM_CODE as CODE, ITEM_NAME as NAME, 'DELETED' COMP_RSLT FROM D
    UNION SELECT ITEM_CODE as CODE, ITEM_NAME as NAME, 'UPDATED' COMP_RSLT FROM U
)


SELECT * FROM T ORDER BY 1 DESC
提出情報
提出日時2024/04/20 06:56:44
コンテスト第12回 SQLコンテスト
問題データ操作履歴
受験者mine
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量84 MB
メッセージ
テストケース(通過数/総数)
3/3
状態
メモリ使用量
データパターン1
AC
83 MB
データパターン2
AC
84 MB
データパターン3
AC
83 MB