实验六 数据检索
来源:互联网 发布:应聘淘宝客服的表格 编辑:程序博客网 时间:2024/04/26 23:22
实验六 数据检索
1、实验目的
(1)掌握SELECT各子句的功能和检索数据的方法
(2)掌握WHERE子句中LINK、IN、BETEEN、IS等逻辑运算符的使用
(3)掌握COMOUTE语句和聚合函数的使用
2、实验内容
(1)查询所有课程的课程编号、课程名和学分
select courseno,cname,creditfrom course
(2)查询‘090501’班的所有学生的基本信息
select * from student wherestudent.classno='090501'
(3)查询student表中所有年龄大于20岁的男生的姓名和年龄
select sname , abs (datediff(YEAR,'2012-12-31',birthday))as '年龄'
from student wherestudent.sex= N'男' and abs (datediff(YEAR,'2012-12-31',birthday))>= 20
(4)查询选修课程且期末成绩不为空的学生人数
select count(*) from course,score,student
where course.courseno= score.courseno and
student.studentno = score.studentno and
course.type= N'选修'and
score.finalis not null
(5)查询Email使用126邮箱的所有学生的学号、姓名和电子邮箱地址。
select studentno,sname,Email
from student
where Email like'%@126.com'
(6)查询每名学生的学号、选修课程数目、总成绩、并将查询结果存放到生成的“学生选课统计表”中。
select student.studentno,student.NUM,grades
into 学生选课统计表
--,@num,grades
from student,course,score
where student.studentno= score.studentnoand
score.courseno= course.courseno
(7)查询score表中选修‘c05109’或‘05103’课程,并且课程期末成绩在90~100分之间的学生姓名和期末成绩。
select student.sname,score.final
from student,course,score
where student.studentno= score.studentnoand
score.courseno = course.courseno and
course.type= N'选修'and
score.final >= 90 and
score.final <= 100 and
(
score.courseno = 'c05109' or
score.courseno = 'c05103'
)
(8)查询student表中所有学生的基本信息,查询结果按班级号classno升序排列,同一班级中的学生按入学成绩point降序排列。
select *from student
order by student.classnoasc , point desc
(9)查询选修‘c05109’课程,并且期末成绩在前5名的学生学号、课程号和期末成绩。
select top 5 student.studentno, score.courseno,score.final
from student,score,course
where student.studentno= score.studentnoand
--course.type= N'选修' and
score.courseno = course.courseno
and course.courseno= 'c05109'
order by score.finaldesc
(10)查询各班学生人数
select count(*) as'人数', classno
from student
group by classno
(11)查询各班期末成绩的最高分和最低分
select max(score.final)as 'max',min(score.final)as 'min' , classno
from student,score,course
where student.studentno= score.studentnoand
course.courseno = score.courseno
group by classno
(12)查询课程编号以‘c05’开头,被3名及以上学生选修且期末成绩的平均分高于75分的课程号、选修人数和期末成绩平均分,并按平均分降序排序。
(13)查询所有08级学生的期末成绩平均分,要求利用COMPUTE BY方法显示每一名学生的学生编号、课程号、期末成绩的明细表,以及期末成绩平均分的汇总表。
- 实验六 数据检索
- 数据实验九 检索
- SQL SERVER实验-- 数据检索
- (六)利用Solr的C#客户端SolrNet检索数据
- 数据检索--区域检索
- 实验六
- 实验六
- 实验六
- 实验六
- 实验六
- 实验六
- 实验六
- 实验六
- 全文检索(六)
- 数据检索
- 数据检索
- 检索数据
- J2ME学习笔记(六)-----连接MIDlet到文本文件和检索数据
- [水题][第一阶段-输出输出][HDOJ-1094]A+B for Input-Output Practice (VI)
- 反射(三)-------要想使用我,先要获取我的引用。
- 实验七 T-SQL语句高级应用(一)
- 实验五 Transact-SQL语句基础
- 实验九 索引和视图
- 实验六 数据检索
- 实验十 视图和存储过程
- 实验七 T-SQL语句高级应用(一)
- 系统分析与设计 选课系统
- [水题][第一阶段-输出输出][HDOJ-1095]A+B for Input-Output Practice (VII)
- do {…} while (0) 的用途汇总(欢迎补充)
- 【cocos2d-x】UserDefault保存数组(ValueVector)
- 基于Mahout的电影推荐系统
- [水题][第一阶段-输出输出][HDOJ-1096]A+B for Input-Output Practice (VIII)