ImageVerifierCode 换一换
格式:DOCX , 页数:16 ,大小:925.18KB ,
资源ID:24494406      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/24494406.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(数据库的嵌套查询实验报告.docx)为本站会员(b****2)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

数据库的嵌套查询实验报告.docx

1、数据库的嵌套查询实验报告实验三:数据库的嵌套查询实验实验目的:加深对嵌套查询语句的理解。实验内容:使用IN、比较符、ANY或ALL和EXISTS操作符进行嵌套查询操作。实验步骤:一. 使用带IN谓词的子查询1. 查询与刘晨在同一个系学习的学生的信息:比较select * from student where sdept in (select sdept from student where sname=刘晨)与: select * from student where sdept = (select sdept from student where sname=刘晨) 的异同比较: selec

2、t * from student where sdept = (select sdept from student where sname=刘晨) and sname 刘晨与: select S1.* from student S1, student S2 where S1.sdept=S2.sdept and S2.sname=刘晨的异同2. 查询选修了课程名为信息系统 的学生的学号和姓名:比较select sno, sname from student where sno in(select sno from sc where cno in (select cno from course

3、where cname=信息系统)与: select sno, sname from student where sno in(select sno from sc, course where o=o and cname=信息系统) 3. 查询选修了课程1和课程2的学生的学号:select sno from student where sno in (select sno from sc where cno=1)and sno in (select sno from sc where cno=2)比较: 查询选修了课程1或课程2的学生的sno:select sno from sc where

4、cno=1 or cno=2比较连接查询: select A.sno from sc A, sc B where A.sno=B.sno and A.cno=1 and B.cno=2 二. 使用带比较运算的子查询4. 查询比刘晨年龄小的所有学生的信息:select * from student where sage (select sage from student where sname=刘晨)三. 使用带Any, All谓词的子查询5. 查询其他系中比信息系(IS)某一学生年龄小的学生姓名和年龄;select sname, sage from student where sage Any

5、 (select sage from student where sdept=IS) and sdeptIS6. 查询其他系中比信息系(IS)学生年龄都小的学生姓名和年龄:select sname, sage from student where sage ALL(select sage from student where sdept=IS) and sdeptIS7. 查询与计算机系(CS)系所有学生的年龄均不同的学生学号, 姓名和年龄:select sno,sname,sage from student where sageall(select sage from student whe

6、re sdept=CS)四. 使用带Exists谓词的子查询和相关子查询8. 查询与其他所有学生年龄均不同的学生学号, 姓名和年龄:select sno,sname,sage from student A where not exists(select * from student B where A.sage=B.sage and A.snoB.sno) 9. 查询所有选修了1号课程的学生姓名:select sname from student where exists(select * from sc where sno=student.sno and cno=1)10. 查询没有选修了1

7、号课程的学生姓名:select sname from student where not exists(select * from sc where sno=student.sno and cno=1)11. 查询选修了全部课程的学生姓名:SQL Server中: select sname from student where not exists(select * from course where not exists( select * from sc where sno=student.sno and cno=o)11. 查询至少选修了学生95002选修的全部课程的学生的学号:SQL

8、Server中:select distinct sno from sc A where not exists (select * from sc B where sno=95002and not exists(select * from sc C where sno=A.sno and cno=B.cno)12. 求没有人选修的课程号cno和cnamecname:select cno,cname from course C where not exists(select * from sc where o=C.cno )13*. 查询满足条件的(sno,cno)对, 其中该学号的学生没有选修该

9、课程号cno的课程SQL Server中:select sno,cno from student,course where not exists(select * from sc where cno=o and sno=student.sno)14*. 查询每个学生的课程成绩最高的成绩信息(sno,cno,grade):select * from sc A where grade=(select max(grade) from sc where sno=A.sno ) 思考:如何查询所有学生都选修了的课程的课程号cno?select cno from sc group by cno having count(*)=(select count(*) from student)

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1