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

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

ID:59324724

大小:20.00 KB

页数:3页

时间:2020-09-05

关系代数及SQL语言的习题.doc_第1页
关系代数及SQL语言的习题.doc_第2页
关系代数及SQL语言的习题.doc_第3页
资源描述:

《关系代数及SQL语言的习题.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、针对书上的学生选课数据库S_T,用关系代数和SQL语言完成以下查询:1、查询“CS”系所有学生的学号和姓名。2、Slelectsno,snamefromstudentwheresdept=’CS’3、查询所有姓“刘”的学生的信息。4、Select*fromstudentwheresnamelike‘刘%’5、查询年龄在18至20岁之间的学生信息。6、Select*fromstudentwheresagebetween18and207、查询不在“CS”系也不在“MA”系的学生的所有信息。8、Select*fromstudentw

2、heresdeptnotin(‘CS’,’MA’)9、查询“CS”系所有学生的平均年龄。10、Selectavg(sage)fromstudentwheresdeptlike‘CS’11、查询课程名是以“系统”结尾的课程信息。12、Select*fromcoursewherecnamelike‘%系统’13、查询先行课为“6”号课程的课程信息。14、Select*fromcoursewherecpno=615、查询间接先行课为“5”号课程的课程号及课程名。16、Selectc1.cno,c1.cnamefromcc1,cc2w

3、herec1.cpno=c2.cnoandc2.cpno=517、Selectcno,cnamefromcoursewherecpnoin(selectcnofromcoursewherecpno=5)18、查询没有先行课的课程名。19、Selectcnamefromcoursewherecpnoisnull20、查询选修了“1”号课程的学生选课信息。21、Select*fromscwherecno=122、查询成绩为90分以上的学生姓名和课程名。23、Selectsname,cnamefroms,c,scwheres.sno

4、=sc.snoandc.cno=sc.cnoandgrade>=9024、查询被选修了的课程号及课程名。25、Selectcno,cnamefromcoursewherecnoin(Selectdistinct(cno)fromsc)26、Selectcno,cnamefromcoursewhereexists(select*fromscwherecourse.cno=sc.cno)1、查询没有选修课程的学生学号及姓名。2、Selectsno,snamefromswheresnonotin(selectdistinct(sno

5、)fromsc)3、Selectsno,snamefromswherenotexists(select*fromscwheres.sno=sc.sno)4、查询没有选修“1”号课程的学生姓名。5、Selectsnamefromswheresnonotin(selectdistinct(sno)fromscwherecno=1)6、Selectsnamefromswherenotexists(select*fromscwheresc.sno=s.snoandsc.cno=1)7、查询既选修了“数据结构”又选修了“操作系统”的学生

6、姓名。8、Selectsnamefroms.c,scwheres.sno=sc.snoandc.cno=sc.cnoandcname=’数据结构’9、Selectsnamefromswheresnoin(selectsnofromscwherecno=(slectcnofromcwherecname=’数据结构’)andsnoin(selectsnofromscwherecno=(selectcnofromcwherecname=’操作系统’)))10、Selectsnamefromswheresnoin(selectsnof

7、romscsc1,scsc2wheresc1.sno=sc2.snoandsc1.cno=(slectcnofromcwherecname=’数据结构’)andsc2.cno=(selectcnofromcwherecname=’操作系统’))11、查询既选修了“2”号又选修了“4”号课程的学生学号。12、Selectsnofromscwherecno=2andsnoin(selectsnofromscwherecno=4)13、Selectsnofromscsc1,scsc2wheresc1.sno=sc2.snoandsc

8、1.cno=2andsc2.cno=414、查询选修了“2”号或“4”号课程的学生学号。15、Selectsnofromscwherecno=2orcno=416、查询至少选修了“95002”学生所选课程的学生学号。17、Selectscx.snofromscscxwhere

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。