虚位以待(AD)
虚位以待(AD)
首页 > 数据库 > Oracle数据库 > oracle复杂查询(学生成绩相关)

oracle复杂查询(学生成绩相关)
类别:Oracle数据库   作者:码皇   来源:张宗朋 的BLOG     点击:

设有一个关系数据库,有三个基本表,表结构如下:表一、student学号stu_id 姓名name 年龄age 性别gender 系号depart_id表二、sc学号stu_id 课程号course_code成绩score表三、course www 2cto com 课程号c

设有一个关系数据库,有三个基本表,表结构如下: 表一、student 学号stu_id 姓名name 年龄age 性别gender 系号depart_id 表二、sc 学号stu_id 课程号course_code  成绩score 表三、course
  www.2cto.com   课程号course_code  课程名course_name 学时数 course_hour 1、编写sql语句,查询系号为990020的同学的学号,姓名,课程名,成绩。
2、编写sql语句,查询比学号是014206202216的同学年龄大1岁的同学的
学号,姓名,年龄。
3、检索选修课程在10门及以上的学生的系号,学号,姓名,最低分,最高分,
平均分和所选课程总数,其结果要求按照系号,平均分排序(降序)。
  4、请用SQL语言检索至少选修了“学号为014206202217的学生选修的
全部课程”的学生的学号和姓名。   【答案】    www.2cto.com   (1) select a.stu_id,a.name,b.course_name,c.score from student a,course
b,sc c where a.stu_id=c.stu_id and c.course_code=b.course_code
and a.depart_id=990020;   (2) select stu_id,name,age from student where age>=1+(select age from
student where stu_id=014206202216);   (3)    

(4)    www.2cto.com  

【注】本文所用到的完整sql语句代码请下载本文的附件!

http://up.2cto.com/2013/0206/20130206015802463.rar
 

相关热词搜索: oracle 复杂 查询