ソースコード
insert into
    DEPARTMENT
values(
    'B300'
    ,'2023-04-01'
    ,null
    ,'新設部門'
    ,(select LAYER from DEPARTMENT where DEPT_CODE = 'A100' and END_DATE is null order by START_DATE desc limit 1)
    ,(select UP_DEPT_CODE from DEPARTMENT where DEPT_CODE = 'A100' and END_DATE is null order by START_DATE desc limit 1)
    ,'1'
    ,(select UPDATE_USER_NAME from DEPARTMENT where DEPT_CODE = 'A100' and END_DATE is null order by START_DATE desc limit 1)
    ,'2023-04-01 00:00:00'
);

update
    DEPARTMENT
set
    END_DATE = '2023-03-31'
    ,VALID_FLG = '0'
    ,UPDATE_USER_NAME = 'ORG_CHG'
    ,USER_UPDATE_DATETIME = '2023-03-31 23:59:59'
where
    DEPT_CODE in ('A100','A200')
;

update
    EMP
set
    DEPT_CODE ='B300'
    ,START_DATE = '2023-04-01'
    ,UPDATE_USER_NAME = 'ORG_CHG'
    ,USER_UPDATE_DATETIME = '2023-04-01 00:00:00'
where
    DEPT_CODE in ('A100','A200')
    and VALID_FLG = '1'
;
提出情報
提出日時2023/04/17 08:36:20
コンテスト第6回 SQLコンテスト
問題組織変更
受験者toridashisoba
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量80 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
80 MB
データパターン2
AC
80 MB