ソースコード

insert into DEPARTMENT values
(
  'B300',
  '2023-04-01',
  NULL,
  '新設部門',
  (select layer from DEPARTMENT where dept_code = 'A100' limit 1),
  (select up_dept_code from DEPARTMENT where dept_code = 'A100' limit 1),
  '1',
  (select UPDATE_USER_NAME from DEPARTMENT where dept_code = 'A100' 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');

with emps as (
select emp_code
from emp e 
left join department d using(dept_code)
where d.dept_code in ('A100', 'A200') and e.valid_flg = '1'
)
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 emp_code in (select emp_code from emps);

select * from emp
提出情報
提出日時2023/06/18 15:29:08
コンテスト第6回 SQLコンテスト
問題組織変更
受験者tac0x2a
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量95 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
95 MB
データパターン2
AC
89 MB