SqlServer2005 建立索引

来源:互联网 发布:社交软件的英文 编辑:程序博客网 时间:2024/06/06 16:24

sqlserver2005中创建索引时通过 create index 来实现的。


创建非簇索引 create index 索引名 on 表名(字段名)

创建非簇索引并不会改变数据的位置。


创建簇索引 create clustered index  索引名 on 表名(字段名)

带簇的索引,行是以索引顺序进行排列的。


创建唯一索引 create unique index 索引名 on 表名(字段名)

唯一索引不允许2行中存在相同的索引值


创建复合索引 create index 索引名 on 表名(字段名1 asc,字段名2 desc……)

复合索引可以表示表示表中的多列


使用索引进行查询 select * from 表名 with (index(索引名))

原创粉丝点击