ソースコード
insert into DEPARTMENT (
    DEPT_CODE,
    START_DATE,
    END_DATE,
    DEPT_NAME,
    LAYER,
    UP_DEPT_CODE,
    VALID_FLG,
    UPDATE_USER_NAME,
    USER_UPDATE_DATETIME
) values (
    'B300',
    '2023-04-01',
    NULL,
    '新設部門',
    (select LAYER from DEPARTMENT where DEPT_CODE = 'A100'),
    (select UP_DEPT_CODE from DEPARTMENT where DEPT_CODE = 'A100'),
    '1',
    (select UPDATE_USER_NAME from DEPARTMENT where DEPT_CODE = 'A100'),
    '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 = 'A100' or DEPT_CODE = 'A200'
;

-- select * from DEPARTMENT where DEPT_CODE = 'B300';
-- select * from DEPARTMENT where DEPT_CODE = 'A100' or DEPT_CODE = '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 = 'A100' or DEPT_CODE = 'A200') and
    VALID_FLG = '1'
;
提出情報
提出日時2023/04/16 20:10:18
コンテスト第6回 SQLコンテスト
問題組織変更
受験者tekihei2317
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量80 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
80 MB
データパターン2
AC
80 MB