ソースコード
with tmp1 as (
    /*追加されたデータ*/
    select 
        t1.item_code as CODE,
        t1.item_name as NAME,
        'ADDED' as COMP_RSLT
    from item as t1
    left outer join item_history as t2
    on t1.item_code=t2.item_code
    where t2.item_code is null
),
tmp2 as (
    /*削除されたデータ*/
    select 
        t1.item_code as CODE,
        t1.item_name as NAME,
        'DELETED' as COMP_RSLT
    from item_history as t1
    left outer join item as t2
    on t1.item_code=t2.item_code
    where t2.item_code is null
),
tmp3 as (
    /*更新されたデータ*/
    select 
        t1.item_code as CODE,
        t1.item_name as NAME,
        'UPDATED' as COMP_RSLT
    from item as t1
    inner join item_history as t2
    on t1.item_code=t2.item_code
    where t1.user_update_datetime>t2.user_update_datetime
)
select * from tmp1
union all select * from tmp2
union all select * from tmp3
order by code desc;
提出情報
提出日時2024/08/18 19:00:13
コンテスト第12回 SQLコンテスト
問題データ操作履歴
受験者kate
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量83 MB
メッセージ
テストケース(通過数/総数)
3/3
状態
メモリ使用量
データパターン1
AC
83 MB
データパターン2
AC
83 MB
データパターン3
AC
83 MB