oracle 视频笔记3(insert、update、delete)
一,INSERT
1.为了不打乱原来的表的数据,所以备份原来的数据.
create table emp2 as select * from emp
create table emp3 as select * from emp
create table dept2 as select * from dept
create table salgrade2 as select * from salgrade
2.查看表的设计情况:desc dept2;表示查看表dept2的设计情况.
3.插入数据的个数与表的数据的个数一样.
如:insert into dept2 values (50, 'game', 'bj')
4.插入数据的个数与表的数据的个数不一样.
如:insert into dept2 (deptno, dname) values (60, 'game2')
5.整个表的插入。
如:insert into dept2 select * from dept2; ,表示pept2表中的数据重复插入了一遍。
4.如果输入“rollback;”,则上面插入的数据就会回滚。
二,UPDATE
如:update emp2 set sal=sal*2, ename=ename||'-' where deptno = 10;
表示把表emp2中的deptno = 10的sal乘以2,在ename的后面加上"-"
三,DELETE
如:delete from emp2; ,表示把emp2这个表整个删除
delete from dept2 where deptno <25; , 表示把表dept2 中的deptno小于25的数据删除.
相关文档:
找到一个介绍oracle版本的文章。
http://wapedia.mobi/en/Oracle_Database#3.
■1979: Larry Ellison and friends founded Software Development Laboratories.
■1979: SDL changed its company-name to "Relational Software, Inc." (RSI) and introduced its product Oracle V2 as an early commercially ......
今天在逛论坛的时候看到shiyiwan同学写了一个很简单的语句,可是order by后面的形式却比较新颖(对于我来说哦),以前从来没看过这种用法,就想记下来,正好总结一下ORDER BY的知识。
1、ORDER BY 中关于NULL的处理
缺省处理,Oracle在Order by 时认为null是最大值,所以如果是ASC升序则排在最后,DESC降序则排在最前。
......
select * from sys.smon_scn_time;
--scn 与时间的对应关系
每隔5分钟,系统产生一次系统时间标记与scn的匹配并存入sys.smon_scn_time表。
select * from student as of scn 592258
就可以看到在这个检查点的表的历史情况。
然后我们恢复到这个检查点
insert into student select * from student a ......
oracle的分析函数over 及开窗函数
一:分析函数over
Oracle从8.1.6开始提供分析函数,分析函数用于计算基于组的某种聚合值,它和聚合函数的不同之处是
对于每个组返回多行,而聚合函数对于每个组只返回一行。
下面通过几个例子来说明其应用。 &nb ......
收集的几条在oracle中通过connect by prior来实现递归查询
Start with...Connect By子句递归查询一般用于一个表维护树形结构的应用。
创建示例表:
CREATE TABLE TBL_TEST
(
ID NUMBER,
NAME VARCHAR2(100 BYTE),
PID NUMBER ......