Oracle基本操作语句(二)
作者:admin 日期:2008-05-10
(1)插入数据
/单行/
insert into scott.emp(empno,ename,hiredate) values(1000,'jack','20-10月-2008');
/批量/
insert into scott.emp(empno,ename,hiredate)(select empno+100,ename,hiredate from scott.emp);
(2)表复制
create table scott.dztest as (select distinct empno,ename,hiredate from scott.emp where empno>=7000);
(3)删除数据
delete from scott.emp where scott.ename='ward';
(4)删除整表数据
truncate table scott.dztest;
(5)更新数据
update scott.emp set ename='dezai' where ename='ward';
(6)嵌套更新
update scott.emp set ename=(select sal from scott.emp where scott.sal='4000') where empno=1245
/单行/
insert into scott.emp(empno,ename,hiredate) values(1000,'jack','20-10月-2008');
/批量/
insert into scott.emp(empno,ename,hiredate)(select empno+100,ename,hiredate from scott.emp);
(2)表复制
create table scott.dztest as (select distinct empno,ename,hiredate from scott.emp where empno>=7000);
(3)删除数据
delete from scott.emp where scott.ename='ward';
(4)删除整表数据
truncate table scott.dztest;
(5)更新数据
update scott.emp set ename='dezai' where ename='ward';
(6)嵌套更新
update scott.emp set ename=(select sal from scott.emp where scott.sal='4000') where empno=1245
评论: 0 | 引用: 0 | 查看次数: 5707
发表评论