读书人

数据字典表目录序列视图

发布时间: 2012-08-14 10:39:58 作者: rapoo

数据字典表——索引——序列——视图
数据字典表(oracle dictionaries)
1 如 desc user_tables
select table_name from user_tables;

desc user_views
select view_name from user_views;

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;
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; 删除序列



读书人网 >其他数据库

热点推荐