1、查询表中创建的索引
select uc.index_name,uc.COLUMN_NAME,ui.uniqueness
from user_indexes ui, user_ind_columns uc
where ui.index_name=uc.INDEX_NAME
and uc.TABLE_NAME='表名'(表名要大写,否则查询不到)
2、创建主键索引
alter table 表名 add constraint 索引名 primary key(字段名);
3、创建普通索引
create (unique)index 索引名 ON 表名(字段名);
4、创建组合索引
create index 索引名 ON 表名(字段名1,字段名2...);
5、删除索引
drop index 索引名;
更多推荐
记录一下Oracle常用的索引相关的sql语句
发布评论