设为首页 加入收藏

TOP

数据字典表/索引/序列/视图简析
2014-11-24 00:34:12 来源: 作者: 【 】 浏览:10
Tags:数据 字典 索引 序列 简析

数据字典表(oracle dictionaries)
1 如 desc user_tables
select table_name from user_tables;
desc user_views
select view_name from user_views;
www.2cto.com
desc user_constraints
select constraint_name from user_constraints;
desc dictionary
select table_name from dictionary;
select table_name from dictionary where table_name like 'user%';
2 索引(index)
index是对表的一列或者是多列进行排序的结构。 它只会增加读的效率而且会是写得效率降低。
create index indexname on tablename(字段);
drop index indexname;
select index_name from user_indexes;
唯一约束和主键约束会自动增加索引。
3 视图(view)
视图只是一个虚拟的表,其物理上是不存在的。
视图可以简化我们的查询,其着重于特定的数据,可以使不必要的数据不出现在视图中,这在一定的程度上增加了 数据库的安全性。
4 序列(sequence)
1 create sequence seq;
select seq.nextval from dual;
.
.
.
insert into xx values(seq.nextval, , );
2 create sequence users_s minvalue 1 nomaxvalue start with 1 increment by 1 nocycle cache 20; www.2cto.com
minvalue 1 序列的最小值为1
nomaxvalue 没有最大值
start with 1 increment by 1 序列的起始值为1 序列的间隔为1
cache 20 高速缓存大小为20
alter sequence users_s maxvalue 1000; 修改最大值为1000
drop sequence users_s; 删除序列

作者 小小程序猿
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇索引、视图、游标、存储过程和触.. 下一篇如何收集系统最繁忙时段的AWR性能..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: