建立索引:
create index table1_idx01 on table1(t1)
create index table2_idx01 on table1(t2)
create index table3_idx01 on table1(t3)
使用其它tablespace的表,要先给当前用户赋权限.可以用GRANT DELETE, INSERT, SELECT, UPDATE ON 其它用户.表 TO 当前用户;
使用时加上
select * from 其它用户.表
索引不需要你显示的去使用,在实际应用中,因为某些字段需要经常需要作为条件来查询,为了提高查询速度,我们就为这些字段建立索引,例如学生表,如果要查看某个学生的详细信息,用得最多可能就是姓名和学号作为条件来查询。
为一个字段创建索引:
create unique index "scott"."empno_uniqueindex" on "scott"."emp"("empno") tablespace "system“
在system表空间下为scott用户的emp表的empno字段创建名为empno_uniqueindex的索引,该索引为scott用户所有