create table employee_info(  
       empno number(3),  
       deptno number(3),  
       ename varchar2(10),  
       sex char(1),  
       phone number(11),  
       address varchar2(50),  
       introduce varchar2(100),
       sal number(7,2)
)我想用这个表创建索引和复合索引,不知道怎么创建,列随便选,谢谢!

解决方案 »

  1.   


    create index indx_empno on employee_info(empno); --一般索引
    create index indx_1 on employee_info(empno,deptno); --复合索引
      

  2.   

    索引:create index iempno on employee_info(empno);
    复合索引:create index iempno_deptno on employee_info(empno,deptno);
      

  3.   

    为什么唯一索引这样创建呢?
    alter table employee_info add constraint uq_address unique(address)???
      

  4.   

    如果当初创建表了,但没有创建唯一的索引就应该是这样创建。
    alter table employee_info add constraint uq_address unique(address)
      

  5.   

    一般理解单个的字段创建索引是普通索引,如果是某个表中创建的多个字段联合索引就是复合索引。
    create index empno  on employee_info(empno)---普通的索引
    create index iempno_deptno on employee_info(empno,deptno);--符合索引。