【文件属性】:
文件名称:oracle 语句
文件大小:158KB
文件格式:DOC
更新时间:2018-07-20 04:04:13
oracle 语句
索引与约束
索引
1、如何建立索引
create index 索引名 on 表名(列名)
create index book_bid_idx on book(bid);
create index abc on student(sid,sname);
create index abc1 on student(sname,sid);他们是不同的
2、查看索引
select index_type,index_name,table_name,uniqueness from user_indexes;
select index_name,table_name,column_name,column_position from user_ind_columns;
3、删除索引
drop index 索引名
4、如何查看是否用索引
@d:D:\oracle\product\10.2.0\db_1\RDBMS\ADMIN\utlxplan.sql—创建了索引查询表
explain plan for select ename,job,sal,comm from empcon where (sal-700)<0;--已解释
desc plan_table;
col id for 999
col operation for a16
col option for a16
col object_name for a16
Select id,operation,options,object_name,position from plan_table;
truncate table plan_table;
explain plan for select ename,job,sal from empcon where ename like ‘PRE%’;
Select id,operation,options,object_name,position from plan_table;