17/12/14 视图and序列、索引

2017-12-14  本文已影响0人  金春国_Roy

17/12/14 视图and序列、索引

视图
create[or replace] view viewname as subquerv

or replace:修改原视图的定义
subquerv:一条完整的select语句

一般不在视图上进行dml操作。

drop view viewname

删除视图并不会删除数据,因为视图是基于数据库中的基表的虚表。

序列
create sequence 序列对象名字
[increment by n] 间隔
[start with n]
[maxvalue n]
[minvalue n]
[cycle|nocycle] 达到最大值或最小值后是否继续产生序列值
索引(index)

索引:
1.对数据库中一列或多个列的值进行排序的一种数据库对象。
2.在数据库中运用索引可以加速对表的查询速度。

create index indexname
on table(column,...)
建议命名格式:idx_tablename_columnname
create table e1 as select * from emp;
insert into e1 set (select* from e1);
update e1 set empno = rownum;
commit

分别在有索引与没有索引的条件下查询一个数据。

上一篇 下一篇

猜你喜欢

热点阅读