sql作业(中)

本文提供了多个SQL查询案例,涵盖成绩高于85分的课程、特定课程的学生信息、教师信息对比等内容,帮助读者掌握复杂的SQL联表查询及子查询技巧。

25 select s.sno,s.sname,s.ssex,s.sbirthday,s.class,t.cno,t.degree from student s inner join score t on s.sno=t.sno order by sno,degree

26 select distinct(cno) from score where degree >85

27 select s.sno,s.cno,s.degree,c.cname,c.tno from score s inner join course c on c.cno=s.cno and c.cname='计算机导论'

28 select tname,prof from teacher where depart='计算机系' and prof not in (select prof from teacher where depart='电子工程系')

29 select s.sno,s.cno,s.degree from score s where s.cno='3-105' and s.degree>(select min(degree) from score where cno='3-245') order by s.degree desc

30 select s.sno,s.cno,s.degree from score s where s.cno='3-105' and s.degree>(select max(degree) from score where cno='3-245')

31 select s.sname,s.ssex,s.sbirthday,t.tname,t.tsex,t.tbirthday from student s inner join score x on x.sno=s.sno left join course c on c.cno=x.cno full join teacher t on t.tno=c.tno

32 select t.tname,t.tsex,t.tbirthday from teacher t where t.tsex='女' union select s.sname,s.ssex,s.sbirthday from student s where s.ssex='女'

33 select s.* from score s where degree <(select avg(ss.degree) from score ss where ss.cno=s.cno)

34 select t.tname,t.depart from teacher t inner join course c on c.tno=t.tno

35 select t.tname,t.depart from teacher t where t.tno not in(select tno from score)

36 select class from student where ssex='男' group by class having count(ssex)>1

37 select * from student s where s.sname not like '王%'

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值