oracle索引基础语句:
------创建表示例用于展示索引
create table organization (
orgNO varchar2(20) not null,
orgName varchar2(20) not null,
orgType char(1) not null,
openDate date,
legalPersion varchar(20),
primary key( orgNo )
)
insert into organization values('1','1','1',SYSDATE,'1');
insert into organization values('2','2','2',SYSDATE,'2');
索引创建:
--语法:create index index_name on table_name(column_name)
--单个索引
create index i_opendate on organization(opendate)
--联合索引
create index i_orgname_orgtype on organization(orgname,orgtype)
索引查询:
--获取索引详细信息
select * from all_indexes where table_name ='ORGANIZATION'(表名大写);
--获取索引名
select index_name from all_indexes where table_name ='ORGANIZATION'(表名大写);
索引修改:
--索引名称修改
alter index i_opendate rename to i_opendate1;
--索引内容修改:REBUILD实际是删除原来的索引后再重新建立
alter index i_opendate rebuid;
索引删除:
--drop index index_name
drop index i_orgname_orgtype;