实验8 数据库合查询.docVIP

  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文档。上传文档
查看更多
实验8 数据库合查询

实验8 数据库综合查询 一、实验目的 掌握SELECT语句的基本语法和查询条件表示方法; 掌握查询条件种类和表示方法; 掌握连接查询的表示及使用; 掌握嵌套查询的表示及使用; 了解集合查询的表示及使用。 二、实验环境 已安装SQL Server 2005的计算机;具有局域网环境,有固定IP。 三、实验学时 2学时 四、实验要求 了解SELECT语句的基本语法格式和执行方法; 了解连接查询的表示及使用; 了解嵌套查询的表示及使用; 了解集合查询的表示及使用; 完成实验报告; 五、实验内容及步骤 以实验8数据为基础,请使用T-SQL 语句实现进行以下操作: 查询以‘数据_’开头,且倒数第3个字符为‘结’的课程的详细情况; select * from course where Cname like 数据%结__; 查询名字中第2个字为‘阳’的学生姓名和学号及选修的课程号、课程名; select Cno,Cname from course where exists (select * from sc where exists (select * from student where course.Cno = sc.Cno and Sname like _阳%)); select student.Sno,Sname,Sdept,course.Cno,Grade from student,sc,course where Cname in (数学,大学英语) and course.Cno = sc.Cno and student.Sno = sc.Sno; ; select * from student where Sno in (select distinct Sno from sc where Grade IS NULL); 查询与‘张力’(假设姓名唯一)年龄不同的所有学生的信息; select * from student where Sage !=any (select Sage from student where Sname = 张力);select student.Sno,Sname,avg(Grade) as 平均成绩 from student inner join sc on student.sno=sc.sno group by student.Sno,Sname having avg(Grade) (select avg(Grade) from student inner join sc on student.sno=sc.sno where sc.Sno = student.Sno and Sname = 张力);select student.Sno,Sname,Sdept,sum(case when grade60 then ccredit end) as 已修学分 from student,sc,course group by student.Sno,Sname,Sdept;select student.Sno,Sname,Sdept,Grade from student,sc where student.Sno = sc.Sno and student.Sno in(select sc.Sno from student,sc where student.Sno = sc.Sno group by sc.Sno having count(sc.Sno) = 1); 查找选修了至少一门和张力选修课程一样的学生的学号、姓名及课程号; select student.Sno,Sname,Cno from student,sc where student.Sno = sc.Sno and Cno in(select Cno from student,sc where Sname = 张力and student.Sno = sc.Sno);select S.Sno,S.Sname,S.Ssex,S.Sage,S.Sdept from student S where S.Sno in (select S1.Sno xuehao from sc S1,sc S2 where S1.Sno=S2.Sno and S1.Cno=( select Cno fro

文档评论(0)

gov469 + 关注
实名认证
文档贡献者

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

1亿VIP精品文档

相关文档