数据字典表/索引/序列/视图简析

来源:未知 责任编辑:责任编辑 发表时间:2013-11-26 22:15 点击:

数据字典表(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; 删除序列 

 
 
作者 小小程序猿
    发表评论
    请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
    用户名: 验证码:点击我更换图片
    最新评论 更多>>

    推荐热点

    • Request.ServerVariables 参数大全
    • 执行全文索引时出现权限不足的解决方法
    • 导入excel文件处理流程节点的解决方案
    • 查看sql修改痕迹(SQL Change Tracking on Table)
    • App数据层设计及云存储使用指南
    • PostgreSQL启动过程中的那些事三:加载GUC参数
    • MongoDB安装为Windows服务方法与注意事项
    • Percolator与分布式事务思考(二)
    • 写给MongoDB开发者的50条建议Tip1
    网站首页 - 友情链接 - 网站地图 - TAG标签 - RSS订阅 - 内容搜索
    Copyright © 2008-2015 计算机技术学习交流网. 版权所有

    豫ICP备11007008号-1