索引

  • UNIQUE:唯一索引
  • CLUSTERED:聚集索引
  • NONCLUSTERED:非聚集索引
    1 use Sales
    2 create table goods 
    3 (
    4     id int,
    5     name char(20),
    6     price float
    7 )
    8 create index id_index on goods(id)
    建立唯一聚集索引:
    1 create unique clustered index name_index
    2 on goods(name)


    建立非聚集索引:

    create index aaa on goods(id asc, name desc)


    创建分区索引:

    1 --创建分区索引
    2 create nonclustered index index_nonclustered_part
    3     on partitiontable(col1)
    4     on ppss2(col1);


    删除索引:(需指定表名)

    drop index name_index on goods
原文地址:https://www.cnblogs.com/2020R/p/13172623.html