关系代数及SQL语言的练习习题.docxVIP

  1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
  4. 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
  5. 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们
  6. 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
  7. 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
针对书上的学生选课数据库 S_T,用关系代数和 SQL语言完成以下查询: 1、 查询“ CS”系所有学生的学号和姓名。 2、 Slelect sno,sname from student where sdept = ’CS’ 3、 查询所有姓“刘”的学生的信息。 4、 Select * from student where sname like ‘刘 %’ 5、 查询年龄在 18 至 20 岁之间的学生信息 。 6、 Select * from student where sage between 18 and 20 7、 查询不在“ CS”系也不在“ MA”系的学生的所有信息。 8、 Select * from student where sdept not in ( ‘CS’, ’MA’) 9、 查询“ CS”系所有学生的平均年龄。 10、 Select avg(sage) from student where sdept like ‘CS’ 11、 查询课程名是以“系统”结尾的课程信息。 12、 Select * from course where cname like ‘%系统’ 13、 查询先行课为“ 6”号课程的课程信息。 14、 Select * from course where cpno=6 15、 查询间接先行课为“ 5”号课程的课程号及课程名。 16、 Select , from c c1,c c2 where = and =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 null 20、 查询选修了“ 1”号课程的学生选课信息。 21、 Select * from sc where cno=1 22、 查询成绩为 90 分以上的学生姓名和课程名。 23、 Select sname ,cname from s,c,sc where = and = and grade=90 24、 查询被选修了的课程号及课程名。 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 = 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 = 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 = and =1) 33、 查询既选修了“数据结构”又选修了“操作系统”的学生姓名。 34、 Select sname from ,sc where = and = 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 snamefrom s where sno in (select and =(slect cno from c where cname= cno from c where cname= ’操作系统’ ))  sno from sc sc1,sc sc2 where ’ 数据结构’ ) and =(select 37、 查询既选修了“ 2”号又选修了“ 4”号课程的学生学号。 38、 Select sno from sc where cno=2 and

文档评论(0)

152****9446 + 关注
实名认证
文档贡献者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档