ソースコード
with added as(
    select
        i.item_code as CODE
        ,i.item_name as NAME
        ,'ADDED' as COMP_RSLT
    from item as i
    left outer join item_history as ih
    on i.item_code = ih.item_code
    where ih.item_code is null
)
,upd 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 ih
    on i.item_code = ih.item_code
    where i.USER_UPDATE_DATETIME <> ih.USER_UPDATE_DATETIME
)
,del as(
    select
        ih.item_code as CODE
        ,ih.item_name as NAME
        ,'DELETED' as COMP_RSLT
    from item as i
    right outer join item_history as ih
    on i.item_code = ih.item_code
    where i.item_code is null
)

select * from 
(
    select * from added
    union
    select * from upd
    union
    select * from del
)
order by CODE desc
提出情報
提出日時2024/07/23 13:39:59
コンテスト第12回 SQLコンテスト
問題データ操作履歴
受験者HamamatsuUnagi
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量88 MB
メッセージ
テストケース(通過数/総数)
3/3
状態
メモリ使用量
データパターン1
AC
88 MB
データパターン2
AC
88 MB
データパターン3
AC
83 MB