设为首页 加入收藏 联系我们
+  最新公告
+ 更多  
导航分类  
数据正在添加中!

厂商认证
·微软MCP考试信息
·致已购买非正常渠道思科折扣号的
·关于对微软考生身份证件的政策
·7月1日起微软将不再免费寄发纸
·ITIL 考后证书需重新申请
·重庆协创思科授权培训中心(重庆
·证书丢了怎么办
文章集萃
 
Oracle数据库中的视图与索引
  发布者: 发布时间:2014/12/12 18:08:37 阅读:681次 【字体:

  重庆协创Oracle培训中心与您分享Oracle数据库视图和索引是什么。

  视图

  以经过定制的方式显示来自一个或多个表的数据。

  创建视图:

  create or replace view user_tbl_view(vid,vname,vage) as select id,user_name,age from user_tbl [with check option]|[with read only];

  创建带有错误的视图:

  create force view user_tbl_force_view as

  select * from user_table;——此时user_table可以不存在。

  创建外联接视图:

  create view user_stu_view as select u.id,u.user_name,u.password,s.ddress from user_tbl u,stu_tbl s

  where u.s_id(+)=s.id;--若哪一方带有(+),哪一方就是次要的

  删除视图:

  drop user_stu_view;

  索引

  用于提高SQL语句执行的性能

  索引类型:

  唯一索引,位图索引,组合索引,基于函数的索引,反向键索引。

  创建标准索引:

  create index user_id_index on user_tbl(id) tablespace schooltbs;

  重建索引:

  alter index user_id_index rebuild;

  删除索引:

  drop index user_id_index;

  创建唯一索引:

  create unique index user_id_index on user_tbl(id);

  创建组合索引:

  create index name_pass_index on user_tbl(user_name,password);

  创建反向键索引:

  create index user_id_index on user_tbl(id) reverse;