日期:2014-05-17 浏览次数:20668 次
--创建聚集索引:
create index idx_col on tb(col)
--创建非聚集索引:
create nonclustered index idx_col on tb(col)
if OBJECT_ID('tb') is not null
drop table tb
go
create table tb(id int,v varchar(10),vv int)
insert into tb
values(1,'abc',10)
insert into tb
values(2,'def',12)
--drop index idx_tb_col on tb
--聚集索引
create clustered index idx_tb_col on tb(id)
--非聚集索引
create nonclustered index idx_tb_col_v on tb(v)
--建立复合索引
create nonclustered index idx_tb_col_v_vv on tb(v,vv)
--建立具有include列的索引
create nonclustered index idx_tb_col_in_v_vv on tb(v) include(vv)
我觉得问这种问题的人应该不会create index都不懂的,我觉得他应该是问:怎样建索引才有效