1,创建索引index;若表中已经创建primary key或unique则不可再创建index.
表结构:
SQL> desc test3;
名称 是否为空? 类型
----------------------------------------- -------- ----------------------------
ID NOT NULL NUMBER(38)
LNAME VARCHAR2(20)
FNAME VARCHAR2(20)
SQL> create index testindex3
2 on test3(id);
on test3(id)
*
第 2 行出现错误:
ORA-01408: 此列列表已索引
手工在另外一个字段上创建索引;
SQL> create index testindex3
2 on test3(lname);
索引已创建。
2,创建带有表达式的索引;如下将fname大写:
SQL> create index testindex31
2 on test3(upper(fname));
索引已创建。
3,删除索引;
SQL> drop index testindex31;
索引已删除。
阅读(1248) | 评论(0) | 转发(0) |