云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > 数据库原理实验报告

数据库原理实验报告

  • 62 次阅读
  • 3 次下载
  • 2025/6/8 3:58:26

四 嵌套、相关及其他

1 查询平均分不及格的学生人数

select COUNT(*) from student where Sno in(

select Sno from SC group by Sno having AVG(Grade)<60 )

2 查询没有选修1002 课程的学生的学生姓名

41

select Sname from student where Sno not in( select Sno from SC where Cno = '3001' )

3 查询平均分最高的学生学号及平均分 (2种方法 TOP , any , all)

a: select top 1 Sno,avg(Grade) from SC group by Sno order by avg(Grade) desc B: select Sno,avg(Grade) from SC group by Sno

having avg(Grade) = (select top 1 avg(Grade) from SC group by Sno order by avg(Grade) desc ) c: select Sno,avg(Grade) from SC group by Sno

having avg(Grade) >=all ( select avg(Grade) from SC group by Sno )

42

*4 查询没有选修1001,1002课程的学生姓名。

Select Sname from student where not exists (

Select * from course where Cno in ('3001','3002') and

Not exists ( select * from SC where Sno=student.Sno and Cno=course.Cno ) )

5 查询1002课程第一名的学生学号(2种方法)

select top 3 Sno from SC group by Sno order by avg(Grade) desc

6 查询平均分前三名的学生学号

select top 3 sno from sc group by sno order by avg(grade) desc

43

7 查询 JSJ 系的学生与年龄不大于19岁的学生的差集

a: select * from student where Sdept='JSJ' and Sage>19 b: select * from student where sdept='JSJ' except select * from student where sage<19

8 查询1001号课程大于90分的学生学号、姓名及平均分大于85分的学生学号、姓名 select student.Sno,Sname from student,SC where Cno='1081' and Grade>90 union select Sno,Sname from student where Sno in( select Sno from SC group by Sno having AVG(Grade)>85 )

44

搜索更多关于: 数据库原理实验报告 的文档
  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

四 嵌套、相关及其他 1 查询平均分不及格的学生人数 select COUNT(*) from student where Sno in( select Sno from SC group by Sno having AVG(Grade)<60 ) 2 查询没有选修1002 课程的学生的学生姓名 41 select Sname from student where Sno not in( select Sno from SC where Cno = '3001' ) 3 查询平均分最高的学生学号及平均分 (2种方法 TOP , any , all) a: selec

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com