SQL作业(下)

本文精选了多个实用的SQL查询案例,包括学生年龄计算、日期范围筛选、特定性别课程查询等,帮助读者掌握复杂查询的编写技巧。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

38 select s.sname,to_char(sysdate,'yyyy')-to_char(s.sbirthday,'yyyy') from student s where s.sbirthday is not null

39 select max(to_char(s.sbirthday,'mm/dd')),min(to_char(s.sbirthday,'mm/dd')) from student s

40 select s.* from student s where s.sbirthday is not null order by s.class,to_char(sysdate,'yyyy')

41 select c.tno,c.cno from course c inner join teacher t on t.tno=c.tno where t.tsex='男'

42 select s.sno,s.cno,s.degree from score s where degree=(select max(degree) from score)

43 select s.sname from student s where s.ssex in (select ssex from student where ssex='男')

44 select s.sname from student s where s.ssex in (select ssex from student where ssex='男') and s.class in
(select class from student where sname='李军')

45 select s.* from score s inner join course c on c.cno=s.cno inner join student ss on ss.sno=s.sno
where ss.ssex='男' and c.cname='计算机导论'

转载于:https://www.cnblogs.com/kaililikai/p/5972092.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值