admin管理员组文章数量:1530925
2024年6月4日发(作者:)
sqlserver实验答案
【篇一:sqlserver2008实用教程实验参考答案(实验6)】
=txt>一、索引
当表中数据量很大时,合理建立索引,可以提高查询的效率。
1. 对yggl数据库的employees表中的departmentid列建立索引
create index em_d_ind on employees(departmentid)
2. 在employees表的name列和address列上建立复合索引
create index em_na_ind on employees(name,address)
3. 对departments表上的departmentname列建立唯一非聚集索引
create unique index de_n_ind on departments(departmentname)
4. 重建索引
alter index all on employees rebuild
5. 删除索引
drop index em_d_id on employees
一次删除多个索引
drop index _d_ind,_na_ind
6. 使用界面方式创建、删除索引
二、数据完整性
1. 创建一个表employees5,只含有employeeid、name、sex和education列。将
name设为主键,并对employeeid列进行unique约束。
验证主键约束和唯一约束。
create table employees5
(
)
employeeid char(6) not null, name char(10) not null primary key, sex bit,
education char(4) constraint uk_id unique(employeeid)
2. 删除上例中创建的unique约束,删除后再验证唯一约束。
版权声明:本文标题:sqlserver实验答案 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/xitong/1717452484a573872.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论