day 23 索引

-- 创建唯一聚集索引
create unique clustered        --表示创建唯一聚集索引
index UQ_Clu_StuNo        --索引名称
on Student(S_StuNo)        --数据表名称(建立索引的列名)
with 
(
    pad_index=on,    --表示使用填充
    fillfactor=50,    --表示填充因子为50%
    ignore_dup_key=on,    --表示向唯一索引插入重复值会忽略重复值
    statistics_norecompute=off    --表示启用统计信息自动更新功能
)

-- 创建唯一非聚集索引 create unique nonclustered --表示创建唯一非聚集索引 index UQ_NonClu_StuNo --索引名称 on Student(S_StuNo) --数据表名称(建立索引的列名) with ( pad_index=on, --表示使用填充 fillfactor=50, --表示填充因子为50% ignore_dup_key=on, --表示向唯一索引插入重复值会忽略重复值 statistics_norecompute=off --表示启用统计信息自动更新功能 )



--创建非聚集覆盖索引
create nonclustered index NonClu_Index
on Student(S_StuNo)
include (S_Name,S_Height)
with(drop_existing=on)

猜你喜欢

转载自www.cnblogs.com/simly/p/9641187.html