Oracle查询12-19题等

12、查询Score表中至少有5名学生选修的并以3开头的课程的平均分数。

select cno,count(cno),avg(degree) from score t group by cno having count(cno)>=5 and substr(cno,0,1)='3'

13、查询分数大于70,小于90的Sno列。

select degree from score s where degree between 70 and 90;

 

14、查询所有学生的Sname、Cno和Degree列。

select s.sname,sc.cno,sc.degree from STUDENT s,score sc where s.sno=sc.sno

15、查询所有学生的Sno、Cname和Degree列。

select s.sno,c.cname,s.degree from score s,course c where s.cno=c.cno;

16、查询所有学生的Sname、Cname和Degree列。

select s.sname,c.cname,sc.degree from student s,course c,score sc where s.sno=sc.sno and  c.cno=sc.cno

17、 查询“95033”班学生的平均分。

select class,cno,avg(degree) from score,student t  where class='95033' group by cno,class

 

 

19、  查询选修“3-105”课程的成绩高于“109”号同学成绩的所有同学的记录。

Select sno,degree from score t where cno='3-105'
and degree>(select degree from score t where cno='3-105'and sno='109')

 

posted @ 2016-06-13 09:37  鱼在我这里  阅读(263)  评论(0编辑  收藏  举报