oracle9i學習筆記之十一(2) 索引

2021-04-23 04:23:24 字數 785 閱讀 3277

1.建立索引

create index index

on table (column [,column]...);

例1:提高對emp表的ename的查詢速度

create index emp_ename_idx on emp(ename);

例2.建立基於函式的索引

create index upper_idx on emp(upper(ename));

2.驗證索引

user_indexes資料字典檢視包含索引的名稱及其唯一性

user_ind_columns資料字典檢視包含索引名稱、表名以及列名

select ic.index_name,ic.column_name,ic.column_position col_pos,ix.uniqueness

from   user_indexes ix,user_ind_columns ic

where  ic.index_name=ix.index_name

and    ic.table_name='emp';

3.刪除索引

drop index index;

例:drop index emp_ename_idx;

練習1.在emp表的外來鍵列上建立非唯一索引

create index deptno_idx on emp(deptno);

2.查詢索引是否建立

select * from user_indexes;

3.刪除所建立的索引

drop index deptno_idx;

oracle9i學習筆記之十一(2) 索引

1.建立索引 create index index on table column column 例1 提高對emp表的ename的查詢速度 create index emp ename idx on emp ename 例2.建立基於函式的索引 create index upper idx on ...

oracle9i學習筆記之十一(3) 同義詞

1.建立同義詞 create public synonym synonym for object 例1 為檢視dept sum vu建立乙個簡潔的名字 create synonym d sum for dept sum vu 例2 建立公共同義詞提供給所有使用者使用 create public sy...

學習oracle9i 筆記(2)

接著上一次的筆記,我在把我一些學習oracle9i的心得繼續記錄下來,為那些剛剛學習oracle 的人,一些幫助 oracle中常用的資料型別為 常用的資料庫字段型別如下 字段型別 中文說明 限制條件 其它說明 char 固定長度字串 最大長度2000 bytes varchar2 可變長度的字串 ...