oracle上建立索引

2021-08-25 07:38:20 字數 799 閱讀 7691

適當的使用索引可以提高資料檢索速度,可以給經常需要進行查詢的字段建立索引

oracle的索引分為5種:唯一索引,組合索引,反向鍵索引,位圖索引,基於函式的索引

建立索引的標準語法:

create index 索引名 on 表名 (列名)

tablespace 表空間名;

建立唯一索引:

create unique index 索引名 on 表名 (列名)

tablespace 表空間名;

建立組合索引:

create index 索引名 on 表名 (列名1,列名2)

tablespace 表空間名;

建立反向鍵索引:

create index 索引名 on 表名 (列名) reverse

tablespace 表空間名;

eg://建立入學年級索引在班級表

create index rxny_szyx_bj_idx on xx_bj(bj_rxny) tablespace welcome;

//建立入學年級索引在學生表

create index rxny_szyx_xs_idx on xs_xs(xs_rxny) tablespace welcome;

//在考生表上入學年級建索引

create index rxnj_szyx_ks_idx on xs_ks(ks_rxny) tablespace welcome;

//在班級表上建立索引

create index xx_bj_idx on xx_bj(bj_id) tablespace welcome;

oracle 建立索引

要在oracle資料庫中使用索引,首先需要建立oracle索引。下面就為您介紹建立oracle索引的方法,希望對您能有所幫助。適當的使用索引可以提高資料檢索速度,可以給經常需要進行查詢的字段建立索引。oracle的索引分為5種 唯一索引,組合索引,反向鍵索引,位圖索引,基於函式的索引 建立oracl...

oracle建立索引

create recreate indexes 建立索引 一張表上建立多個索引,一般是該錶的資料量大,建立索引能夠提高資料庫的select效能。一般是在要select的字段建立索引。oracle建立索引語法 create index indexname on tablename colum crea...

oracle建立索引

建立乙個使用者 set sqlprompt user create user jsx identified by 123 建立使用者jsx grant all privileges to jsx 給使用者授權 conn jsx 123 建立books表 create table books book...