17,377
社区成员
发帖
与我相关
我的任务
分享
--你也可以在建立表之后再为表中的列建立索引:
create table t2(
t_id number(2),
t_col varchar2(10),
t_col2 date
);
create index idx_t_id
on t2(t_id)
tablespace users;
--在建立表的时候,oracle会为你的主键和唯一键建立个建立一个索引:
--实例:
SQL> create table t(
2 t_id number(2) primary key,
3 t_col varchar2(5) unique,
4 t_col2 date default sysdate
5 );
Table created
SQL> select index_name,column_name
2 from user_ind_columns
3 where table_name='T';
INDEX_NAME COLUMN_NAME
------------------------------ --------------------------
SYS_C005418 T_ID
SYS_C005419 T_COL