sql索引
创建索引
使用CREATE 语句创建索引
CREATE INDEX index_name ON table_name(column_name,column_name) include(score)
普通索引
CREATE UNIQUE INDEX index_name ON table_name (column_name) ;
非空索引
CREATE PRIMARY KEY INDEX index_name ON table_name (column_name) ;
主键索引
使用ALTER TABLE语句创建索引
alter table table_name add index index_name (column_list) ;
alter table table_name add unique (column_list) ;
alter table table_name add primary key (column_list) ;
删除索引
drop index index_name on table_name ;
alter table table_name drop index index_name ;
alter table table_name drop primary key ;
查询索引
select object_name(object_id) tableName,name,type_desc from sys.indexes where name='Hishop_Articles_ArticleId' //索引名称 Hishop_Articles_ArticleId