oracle索引的建立,修改和删除
2016-11-11 16:09 绿贝 阅读(511) 评论(0) 编辑 收藏 举报索引的建立,修改和删除。
删除索引
DROP INDEX indexname
例如:
sql> drop index IDX_DRIVERIDCARD;
建立索引
CREATE INDEX
CREATE [unique] INDEX [user.]index
ON [user.]table (column [ASC | DESC] [,column
[ASC | DESC] ] ... )
[CLUSTER [scheam.]cluster]
[INITRANS n]
[MAXTRANS n]
[PCTFREE n]
[STORAGE storage]
[TABLESPACE tablespace]
[NO SORT]
Advanced
CREATE [unique] INDEX [user.]index
ON [user.]table (column [ASC | DESC] [,column
[ASC | DESC] ] ... )
[CLUSTER [scheam.]cluster]
[INITRANS n]
[MAXTRANS n]
[PCTFREE n]
[STORAGE storage]
[TABLESPACE tablespace]
[NO SORT]
Advanced
例如:
sql> Create index IDX_DRIVERIDCARD on driver (idcard);建立非唯一索引
sql> Create unique index IDX_DRIVERIDCARD on driver (idcard); 建立唯一索引
修改的话,删了再建一个索引就行啦~~
转换类型
select
cast('车票' as varchar2(8))
from ticketsell