网站大量收购独家精品文档,联系QQ:2885784924

实验五SQL语言概要.doc

  1. 1、本文档共11页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
实验五SQL语言概要

实验 一、目的与要求 掌握; 二、实验准备 ; 了解三、实验内容Select St_Name ,St_Sex, St_ID From st_info Where St_Name like 王% 查询全体学生的情况,查询结构按班级降序排列,同一班级再按学号升序,并将结果存入新表new中 select * into new from st_info order by Cl_Name desc,St_ID asc 对S_C_info表中选修了“体育”课的学生的平均成绩生成汇总行和明细行。(提示:用compute汇总计算) Select c_no,score From s_c_info Where c_no compute avg(score) 2.嵌套查询 查询其他班级中比“材料科学0601班”的学生年龄都大的学生姓名和年龄 Select St_Name ,Born_Date from st_info where Cl_Name!=材料科学0601班 and Born_Date(select Min(Born_Date) from st_info where Cl_Name=材料科学0601班) 用exists查询选修了“9710041”课程的学生姓名 select St_Name from st_info where exists (select * from s_c_info where c_no = 9710041 and st_id=st_info.St_ID ) 用in查询找出没有选修“9710041”课程的学生的姓名和所在班级。 select St_Name,Cl_Name from st_info where st_ID not in (select st_id from s_c_info where c_no =9710041) 查询选修了学号为“2001050105”的学生所选全部课程的学生姓名。 select St_Name from st_info where St_ID in (select distinct St_ID from s_c_info where not exists (select * from s_c_info where st_id=2001050105 and not exists (select * from s_c_info where st_info.St_ID=s_c_info.st_id and c_no=any(select c_no from s_c_info where st_id=2001050105)))) 3.连接综合查询及其他 查询每个学生所选课程的最高成绩,要求列出学号,姓名,课程编号和分数。 select st_info.St_ID, St_Name,C_info.c_no,score from st_info inner join s_c_info on st_info.St_ID=s_c_info.st_id inner join C_info on s_c_info.c_no=C_info.c_no where score=(select max(s_c_info.score)from s_c_info where st_info.St_ID=s_c_info.st_id) 查询所有学生的总成绩,要求列出学号、姓名、总成绩,没有选修课程的学生总成绩为空。 select st_info.St_ID,St_Name,总成绩 from st_info left outer join (select st_id,sum(score)as 总成绩 from s_c_info group by st_id)s_c_info on st_info.St_ID=s_c_info.st_id 查询“大学计算机基础”课程考试成绩前三名的学生姓名和成绩。 select st_info.St_ID,St_Name,score from st_info inner join s_c_info on st_info.St_ID=s_c_info.st_id inner join C_info on s_c_info.c_no=C_info.c_no and c_Name=大学计算机基础 将s_c_info中的score列的值转为等级制输出,即60分以下显示为“不及格”,60~69分显示“及格”,70~79分显示“中等”,80~81显示“良好”,90~100显示“优秀

您可能关注的文档

文档评论(0)

1520520 + 关注
实名认证
内容提供者

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

1亿VIP精品文档

相关文档