一个表里面有  编号(递增列),学号(唯一性),姓名 等多个字段 经常使用学号,姓名,查询  想问下聚集索引可以建在 编号上吗? 好象有人说递增列不能建立聚集索引 这3个字段到底该怎么建立索引呢? 望高手指教下 谢了先

解决方案 »

  1.   

    create index on 表(姓名)
    create index on 表(学号)
      

  2.   


    create nonclustered index   on   表(姓名) 
    create clustered  index   on   表(学号)
      

  3.   

    学号可以作为主键,应建立簇索引,而姓名经常用于连接和where 子句中并且值有机会要修改,所以建产非簇索引合适一点
      

  4.   

    [code=SQL]create   index   on   tb(姓名) 
    create   index   on   tb(学号)code]
      

  5.   

    [code=SQL]create       index       on       tb(姓名)   
    create       index       on       tb(学号)[code] 
      

  6.   

    create               index               on               tb(姓名)       在姓名上建索引,学号设为主键,,,
      

  7.   

    感谢大家 还有个递增列编号不要建立索引吗?以后删除记录是要根据它的吧? 比如 delete  fron fff  where ID=编号