oracle练习20-23

本文提供了多个SQL查询案例,包括查询多门课程的非最高分记录、特定条件下的学生成绩及个人信息等。通过这些实例,读者可以学习如何利用子查询和连接操作来获取所需的数据。

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值