资源预览内容
第1页 / 共11页
第2页 / 共11页
第3页 / 共11页
第4页 / 共11页
第5页 / 共11页
第6页 / 共11页
第7页 / 共11页
第8页 / 共11页
第9页 / 共11页
第10页 / 共11页
亲,该文档总共11页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
.沈 阳 工 程 学 院学 生 实 验 报 告(课程名称:数据库原理及应用)实验题目: 数据库中数据的查询(二) 班 级 信安本111学 号 2011416109 姓 名 夏彬珊 日 期 2013.10.28地 点 F612指导教师 孙先丽 祝世东 一、实验目的掌握SQL查询命令:包括连接查询、嵌套查询和集合查询。二、实验环境Oracle10g数据库系统。三、实验内容与要求使用Select命令完成下列数据查询。一、连接查询查询每个学生及其选修课程的情况。查询男学生选修课成绩不及格的情况。查询计算机系学生选修课成绩不为空的情况。查询选修2号课程且分数在90分以上的所有学生。查询每个学生的学号,姓名,选课名及成绩。查询选修了课程,但没有参加考试(成绩为空)的学生学号,姓名,选课名及成绩。二、嵌套查询查询与张三在同一系的学生。查询选修了课程名为数据库的学生学号和姓名。三、EXISTS查询 查询没有选修1号课程的学生的姓名。查询选修了所有课程的学生的姓名。四、实验过程及结果分析一、连接查询查询每个学生及其选修课程的情况。select student.*,sc.*from student,scwhere student.sno=sc.sno;查询男学生选修课成绩不及格的情况。select sname,cname,gradefrom student,sc,coursewhere ssex=男 and grade90;查询每个学生的学号,姓名,选课名及成绩。select student.sno,sname,cname,gradefrom student,sc,coursewhere student.sno=sc.sno and sc.cno=course.cno;查询选修了课程,但没有参加考试(成绩为空)的学生学号,姓名,选课名及成绩。select student.sno,sname,cname,gradefrom student,sc,coursewhere student.sno=sc.sno and sc.cno=course.cno and sc.cno is not NULL and grade is NULL二、嵌套查询查询与张三在同一系的学生。select sdeptfrom studentwhere sname=张三;查询选修了课程名为数据库的学生学号和姓名。select sno,snamefrom studentwhere sno in(select snofrom scwhere cno in(select cnofrom coursewhere cname=数据库);分析:少打个括号三、EXISTS查询 查询没有选修1号课程的学生的姓名。分析:student和sno中间有个点且没空开查询选修了所有课程的学生的姓名。 select snamefrom studentwhere not exists(select*from coursewhere not exists(select*from scwhere sno=student.snoand cno=course.cno);五、成绩评定优良中及格不及格出 勤格 式内 容分 析总 评指导教师: 年 月 日精选word范本!
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号