​Oracle操作:updat & delete

prompt 0. init env

set pagesize 99;
set linesize 160;

prompt 0.1 demo for delete statement

--delete from tableName where condition

--delete from emp where ename in('TANG','HAIBO')or ename is null;

prompt prepare to delete data;

selecte * from emp where empno>2000 and empno<3000;
delete from emp where empno>2000 and empno <3000;

prompt 1.demo for insert statement

--insert into tablename[(fieldlist)] values(valuelist);

insert into emp values (2001,'T','teacher',null,'01-9月-96',800,100,null);
insert into emp (empno,enme,job , mgr, hiredate,sal,comm,deptno)
 value(2002,'t' ,null,null ,null ,900,600 ,null);
inset into emp(ename,empno)
value ('TESTER',2004);
drop table emphighsal as select *from emp where 1=0;
insert into emphighsal select * from emp where sal>2500;

prompt 2.demo for update statement

update emp set sal =sal+100 where empno=2001;
update emp set sal =sal+1000,comm=(sal+1000)*0.1 where empno=2003;

写完保存,最后加句 commit;



转载:转载请注明原文链接 - ​Oracle操作:updat & delete

Life is very interesting. In the end, some of your greatest pains become your greatest strengths.