DML에 대해서 배운다
dml 실습을 위한 테이블 livesql에서 만들기
create table dept01
as
select * from scott.dept where 1 = 0;
create table sam01
as
select empno,ename,job,sal from scott.emp where 1 = 0;
insert into sam01 values (1000,'apple','police',10000);
insert into sam01 values (1010,'banana','nurse',15000);
insert into sam01 values (1020,'orange','doctor',25000);
insert into sam01 values (1030,'very', null,25000);
insert into sam01 (empno, ename, sal) values (1040,'cat',25000);
insert into sam01
select empno, ename, job, sal from scott.emp where deptno = 10;
update sam01 set sal = sal-5000
where sal >= 10000;
update sam02 set (sal, hiredate) = (select sal, hiredate from sam02
where ename = 'KING');
delete from sam01 where job is null;
서브쿼리문을 사용하자
delete from sam02 where deptno = (select deptno from scott.dept where dname = 'RESEARCH');