***********************************************声明***********************************************************************
原创作品,出自 “深蓝的blog” 博客,欢迎转载,转载时请务必注明出处,否则追究版权法律责任。
深蓝的blog:http://blog.csdn.net/huangyanlong/article/details/39903951
****************************************************************************************************************************
--查看实验表原始数据
SQL> select * from newdept;
NEWDEPTNO OLDDEPTNO NEWDNAME OLDDNAME NEWLOC OLDLOC
--------- --------- -------------- -------------- ------------- -------------
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
查看某一列的数据量
SQL> select count(*) from newdept where oldloc is not null;
COUNT(*)
----------
4
update 表名 set列名=值 [,列名=值,...] [where 条件]
例:
SQL> update newdept set newdeptno=08,newdname='BUSINESS',newloc='BEIJING' where olddeptno=30;
--更新一条数据操作
1 row updated
SQL> select * from newdept;
NEWDEPTNO OLDDEPTNO NEWDNAME OLDDNAME NEWLOC OLDLOC
--------- --------- -------------- -------------- ------------- -------------
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
8 30 BUSINESS SALES BEIJING CHICAGO
40 OPERATIONS BOSTON
delete [from] 表名 [where 条件]
SQL> delete from newdept where olddeptno=10;
--删除一条数据操作
1 row deleted
SQL> select * from newdept;
NEWDEPTNO OLDDEPTNO NEWDNAME OLDDNAME NEWLOC OLDLOC
--------- --------- -------------- -------------- ------------- -------------
20 RESEARCH DALLAS
8 30 BUSINESS SALES BEIJING CHICAGO
40 OPERATIONS BOSTON
insert into 表名 [(列名 [,列名...])] values (数值 [,数值...]);
SQL> insert into newdept values (1,'','BDA','','BEIJING','');
--插入一条数据操作
1 row inserted
SQL> select * from newdept;
NEWDEPTNO OLDDEPTNO NEWDNAME OLDDNAME NEWLOC OLDLOC
--------- --------- -------------- -------------- ------------- -------------
20 RESEARCH DALLAS
8 30 BUSINESS SALES BEIJING CHICAGO
40 OPERATIONS BOSTON
1 BDA BEIJING
把一个列插入到新的表中
--把scott用户的emp表的SAL列插入到hyl用户的newdept表中
***********************************************声明***********************************************************************
原创作品,出自 “深蓝的blog” 博客,欢迎转载,转载时请务必注明出处,否则追究版权法律责任。
深蓝的blog:http://blog.csdn.net/huangyanlong/article/details/39903951
****************************************************************************************************************************