select A.sname,sum(B.score) as 总分
from stu as A
inner join sc as B
on A.sid=B.sid
where cid!=2
group by sname
having sname!=’bbb’
order by sum(B.score)
select stu.sname,sc.cid,sc.score
from sc,stu
where sc.sid=stu.sid
—三表联结,显示stu表中sname,课程表course中的课程名cname,成绩表sc中的学生成绩score
select A.sname,C.cname,B.score
from stu A,sc B,course C
where A.sid=B.sid
and B.cid=C.cid
—三表联结,采用内联结来写的另外一种方法,中的sc表既可以和stu表关联,又可以和course表关联,方法在中间
select A.sname,C.cname,B.score
from stu A
inner join sc B
on A.sid=B.sid
inner join course C
on B.cid=C.cid
—左外联
select A.sname,B.cid,B.score
from stu A
left join sc B
on A.sid=B.sid
—全联结
select A.sname,B.cid,B.score
from stu A
full join sc B
on A.sid=B.sid
—交叉联结
select A.sname,B.cid,B.score
from stu A
cross join sc B
—子查询
select *
from stu
where stuAge>
(select stuAge
from stu
where stuName=’李斯文’
)
—使用子查询,查询笔试刚好通过60分的学员信息
select *
from stu
where stuNO in
(
select stuNO
from sc
where writtenexam=60
)
—表连接来做
select A.*
from stu A,sc B
where A.stuNo=B.stuNo
and B.writtenexam=60
—用子查询来做,查询参加考试的学员名单
select stuName
from stu
where stuNO in
(
select stuNo
from sc
)
—用表连接来做,查询参加考试的学员名单
select A.stuName
from stu A,sc B
where A.stuNo=B.stuNo
服务器托管,北京服务器托管,服务器租用 http://www.fwqtg.net
机房租用,北京机房租用,IDC机房托管, http://www.fwqtg.net
相关推荐: SpringCloudStream整合RabbitMQ用ttl+死信实现延迟队列的实践前言yaml配置文件生产者发送消息 消费者监听消息总结
这篇是关于我使用Spring Cloud Steam操作RabbitMQ采用ttl+死信队列的方式实现的延迟队列。 前言 在公司项目中遇到了需要延迟队列的需求,为了以后可维护性和扩展性要求必须要用Springcloud Stream组件来操作mq,而且公司的r…