USE MySchool
GO
IF EXISTS (SELECT name FROM sysindexes
WHERE name = 'IX_Result_StudentResult')
DROP INDEX Result.IX_Result_StudentResult --删除索引
GO
--考试成绩列上创建可重复索引:填充因子为70%--
CREATE INDEX IX_Result_StudentResult
ON Result(StudentResult)
WITH FILLFACTOR = 70
GO
--查询输出学生姓名、课程名称、考试日期和考试成绩
SELECT StudentName '学生姓名',SubjectName '课程名称',ExamDate '考试日期', StudentResult '考试成绩' FROM Subject,Student,Result
WITH (INDEX = IX_Result_StudentResult)
WHERE StudentResult BETWEEN 80 AND 90 AND Student.StudentNo = Result.StudentNo AND Subject.SubjectId = Result.SubjectId
06_04 使用索引查询学生成绩
最新推荐文章于 2021-05-17 23:22:01 发布