数据库多表查询问题,请看图

数据库多表查询问题,请看图,第1张

1、select a.xh,a.xm,a.xb,b.bjmc from xsb a,bjb b where a.id=b.bjb_id

2、select b.xh,b.xm,b.xb,a.bjmc,c.yw,c.sx from bjb a,xsb b,cjb c where a.id=b.bjb_id and b.id=c.id

3、select a.id,a.bjmc,count(*) from bjb a,xsb b where a.id=b.bjb_id group by a.id,a.bjmc

4、select b.xh,b.xm,a.bjmc,c.yw+c.sx from bjb a,xsb b,cjb c where a.id=b.bjb_id and b.id=c.id and c.yw+c.sx>150

5、select a.id,a.bjmc,avg(c.yw),avg(c.sx) from bjb a,xsb b,cjb c where a.id=b.bjb_id and b.id=c.id group by a.id,a.bjmc

1

select a.s# from

(select s#,score from sc where c#='001') a

inner join

(select s#,score from sc where c#='002') b

on a.s#=b.s# and a.score>b.score

2

select student.s#,student.sname,count(*) as 选课数,sum(sc.score) 总成绩

from student,course,sc

where student.s#=sc.s#

and course.c#=sc.c#

3

select s@,sname from student where s# not in

(select s# from sc where c# in

(select c# from course where t#=(select t# from teacher where tname='叶平')))

4

select student.s#,student.sname

from

student,course,sc where

student.s#=sc.s#

and course.c#=sc.c#

and sc.c# in

(select c# from course where t#=(select t# from teacher where tname='叶平'))

group by student.s#,student.sname

having count(*)=(select count(c#) from course where t#=(select t# from teacher where tname='叶平'))


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/sjk/10800589.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-11
下一篇 2023-05-11

发表评论

登录后才能评论

评论列表(0条)

保存