ソースコード
with tbl_add as
(
    select
        ITEM_CODE as CODE
        ,ITEM_NAME as NAME
        ,'ADDED' as COMP_RSLT
    from ITEM
    where ITEM.ITEM_CODE not in (select ITEM_CODE from ITEM_HISTORY)
)
,tbl_del as
(
    select
        ITEM_CODE as CODE
        ,ITEM_NAME as NAME
        ,'DELETED' as COMP_RSLT
    from ITEM_HISTORY
    where ITEM_HISTORY.ITEM_CODE not in (select ITEM_CODE from ITEM)

)
,tbl_upd as
(
    select
        ITEM.ITEM_CODE as CODE
        ,ITEM.ITEM_NAME as NAME
        ,'UPDATED' as COMP_RSLT
    from ITEM
    inner join ITEM_HISTORY
    on ITEM.ITEM_CODE = ITEM_HISTORY.ITEM_CODE
    and ITEM.USER_UPDATE_DATETIME != ITEM_HISTORY.USER_UPDATE_DATETIME

)
select * from tbl_add
union 
select * from tbl_del
union 
select * from tbl_upd
order by
    CODE desc
提出情報
提出日時2024/04/20 17:11:03
コンテスト第12回 SQLコンテスト
問題データ操作履歴
受験者sato
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量87 MB
メッセージ
テストケース(通過数/総数)
3/3
状態
メモリ使用量
データパターン1
AC
87 MB
データパターン2
AC
84 MB
データパターン3
AC
84 MB