oracle练习20-23

20.查询score中选学多门课程的同学中分数为非最高分成绩的记录。

select * from score s where degree <(select max(degree) from score ) 
and cno in(select cno from score group by cno having count(cno)>1)

21、查询成绩高于学号为“109”、课程号为“3-105”的成绩的所有记录。

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

22、查询和学号为108的同学同年出生的所有学生的Sno、Sname和Sbirthday列。

select sno,sname,sbirthday from student t where to_char(sbirthday,'yy')=(select to_char(sbirthday,'yy')from student t where sno='108')

23、查询“张旭“教师任课的学生成绩。

select s.sno,s.degree from score s,course c,teacher t 
where t.tno=c.tno and s.cno=c.cno and t.tname='张旭'

原文地址:https://www.cnblogs.com/miss123/p/5592825.html