oracle 可以在创建表的sql语句中,创建普通的索引吗,还有创建索引可以不指定索引名吗?

解决方案 »

  1.   

    创建表的时候 会给主键创建索引 其他的还是用create index  oracle的基本上每个对象都有名字 
    就是在创建主键索引的时候oracle也会自动给它命名的
      

  2.   

    创建主键索引的,索引是必须有名字的。
    create index in_dx_name 具体的字段。
      

  3.   


    --在建立表的时候,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 createdSQL> 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
      

  4.   


    --你也可以在建立表之后再为表中的列建立索引:
    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 索引介绍
      

  5.   

    使用toad工具,很好的,创建索引都有对应说明
      

  6.   

    对于主键(UNIQUE + NOT NULL) 和 (UNIQUE) 字段, oracle会自动为我们创建索引