oracle中索引的使用语法

来源:互联网 发布:dsdt for mac 编辑:程序博客网 时间:2024/06/04 23:44


   索引:在定义主键 primary key  和 unique 唯一约束时,会自动的在所在的列创建唯一性索引。
         用户可以为其他的列创建非唯一性和唯一性索引。
                  标准的而语法:    create  index  index_name on  table_name (col_name) tablespace tablespace_name;
                  创建唯一的索引:  create  unique  index index_name on  table_name(col_name) tablespace tablespace_name; 
                  创建组合索引:    create  index  inex_name on  table_name (col_name1,col_name2)  tablespace tablespace_name;
         删除索引(需要权限):drop  index  index_name;
      
         根据表名查询一张表中的索引: select  * from  user_indexes where table_name=upper('表名');
         (oracle 自己去决定在什么时候去使用,到底使不使用索引)
原创粉丝点击