


全文预览已结束
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
针对书上的学生选课数据库S_T,用关系代数和SQL语言完成以下查询:1、 查询“CS”系所有学生的学号和姓名。2、 Slelect sno,sname from student where sdept =CS3、 查询所有姓“刘”的学生的信息。4、 Select * from student where sname like 刘%5、 查询年龄在18至20岁之间的学生信息 。6、 Select * from student where sage between 18 and 207、 查询不在“CS”系也不在“MA”系的学生的所有信息。8、 Select * from student where sdept not in (CS,MA)9、 查询“CS”系所有学生的平均年龄。10、 Select avg(sage) from student where sdept like CS11、 查询课程名是以“系统”结尾的课程信息。12、 Select * from course where cname like %系统13、 查询先行课为“6”号课程的课程信息。14、 Select * from course where cpno=615、 查询间接先行课为“5”号课程的课程号及课程名。16、 Select o,ame from c c1,c c2 where c1.cpno=o and c2.cpno=5 17、 Select cno ,cname from course where cpno in (select cno from course where cpno=5)18、 查询没有先行课的课程名。19、 Select cname from course where cpno is null20、 查询选修了“1”号课程的学生选课信息。21、 Select * from sc where cno=122、 查询成绩为90分以上的学生姓名和课程名。23、 Select sname ,cname from s,c,sc where s.sno=sc.sno and o=o and grade=9024、 查询被选修了的课程号及课程名。25、 Select cno ,cname from course where cno in (Select distinct(cno ) from sc)26、 Select cno ,cname from course where exists (select * from sc where o=o)27、 查询没有选修课程的学生学号及姓名。28、 Select sno,sname from s where sno not in (select distinct(sno) from sc)29、 Select sno ,sname from s where not exists(select * from sc where s.sno=sc.sno)30、 查询没有选修“1”号课程的学生姓名。31、 Select sname from s where sno not in (select distinct(sno) from sc where cno=1)32、 Select sname from s where not exists (select * from sc where sc.sno=s.sno and o=1)33、 查询既选修了“数据结构”又选修了“操作系统”的学生姓名。34、 Select sname from s.c,sc where s.sno=sc.sno and o=o and cname= 数据结构35、 Select sname from s where sno in (select sno from sc where cno=(slect cno from c where cname= 数据结构) and sno in (select sno from sc where cno=(select cno from c where cname=操作系统)36、 Select sname from s where sno in (select sno from sc sc1,sc sc2 where sc1.sno=sc2.sno and o=(slect cno from c where cname= 数据结构) and o=(select cno from c where cname=操作系统)37、 查询既选修了“2”号又选修了“4”号课程的学生学号。38、 Select sno from sc where cno=2 and sno in(select sno from sc where cno=4)39、 Select sno from sc sc1,sc sc2 where sc1.sno=sc2.sno and o=2 and o=440、 查询选修了“2”号或“4”号课程的学生学号。41、 Select sno from sc where cno=2 or cno=442、 查询至少选修了“95002”学生所选课程的学生学号。43、 Select scx.sno from sc scx where not exists (select * from sc scy where scy.sno=95002 and not exists (select * from sc scz where o=o and scz.sno=scx.sno)44、 查询至少选修了一门其间接先行课为“7”号课程的学生姓名。45、 Select sname from s where sno in(Select sno from sc where cno in (Select o from c c1,c c1 where c1.cpno=o and c2.cpno=7)46、 查询选修了所有课程的学生姓名。47、 Select sname from s where not exists (select * from c where not exists (select * from sc where o=o and sc.sno=s.sno)48、 查询“李勇”同学所选课程的平均成绩。49、 Select avg(grade) from sc where sno =(Select sno from s where sname =李勇) 50、 查询“操作系统”这门课的最高分及最低分。51、 Select max(grade),min(grade) from sc where cno=(select cno from course where cname =操作系统)52、 查询“数据结构”这门课的选课人数。53、 Select count(sno) from sc where cno =(select cno from course where cname=数据结构)54、 查询“CS”系的所有学生的学号、姓名、课程名及成绩。55、 Select sno,sname,cname,grade from s,sc,c where s.sno=sc.sno and o=o and sdept
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 入院护理流程课件
- 邮政集中采购管理办法
- 2025生殖健康咨询师题库检测试题附完整答案详解【各地真题】
- 超分子分离详解
- 环境执法证件管理办法
- 企业安全按月培训内容课件
- 2025版权质押合同(合同范本)
- 2025合同签订关键要点指导
- 冲床使用安全培训课件
- 冲压设备安全培训大纲课件
- 《高精度三维地震采集设计技术规范》
- 新建四塔流动床项目立项申请报告
- 电工培训课件-时间继电器
- 《采购的沟通与谈判》课件
- 船舶结构与设备课件-第四章-系泊设备
- 初一新生家长会(共27张课件)
- 玉米收割合同范例
- 文书模板-《终止妊娠委托书》
- 三人开早餐店协议书范文模板
- 广东省珠海市文园中学2024-2025学年七年级上学期11月期中考试数学试题(无答案)
- 批判性思维能力测量表(CDTI-CV)-彭美慈
评论
0/150
提交评论