ソースコード
with list as (
    select
        ITEM.ITEM_CODE as CODE,
        ITEM.ITEM_NAME as NAME,
        ITEM.USER_UPDATE_DATETIME as date,
        ITEM_HISTORY.ITEM_CODE as hCODE,
        ITEM_HISTORY.ITEM_NAME as hNAME,
        ITEM_HISTORY.USER_UPDATE_DATETIME as hdate
    from ITEM left join ITEM_HISTORY on ITEM.ITEM_CODE = ITEM_HISTORY.ITEM_CODE
    union
    select
        ITEM.ITEM_CODE as CODE,
        ITEM.ITEM_NAME as NAME,
        ITEM.USER_UPDATE_DATETIME as date,
        ITEM_HISTORY.ITEM_CODE as hCODE,
        ITEM_HISTORY.ITEM_NAME as hNAME,
        ITEM_HISTORY.USER_UPDATE_DATETIME as hdate
    from ITEM_HISTORY left join ITEM on ITEM.ITEM_CODE = ITEM_HISTORY.ITEM_CODE
)
select
    case
        when CODE is not null then CODE
        else hCODE
    end as CODE
    ,
    case
        when NAME is not null then NAME
        else hNAME
    end as NAME,
    case
        when CODE is null AND hCODE is not null then 'ADDED'
        when CODE is not null AND hCODE is null then 'DELETED'
        else 'UPDATED'
    end as COMP_RSLT
from list
order by CODE
;
    
提出情報
提出日時2024/04/22 07:47:41
コンテスト第12回 SQLコンテスト
問題データ操作履歴
受験者eniiiiii_66
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量84 MB
メッセージ
テストケース(通過数/総数)
0/3
状態
メモリ使用量
データパターン1
WA
83 MB
データパターン2
WA
84 MB
データパターン3
WA
84 MB