mysql查询选了课的同学的sid和其平均分

img

img


mysql中查询选了课的同学的sid及其平均分要怎样写?第九题我写的select sc.sid,avg(score) from student,course,sc where sc.cid is not null 查询后的结果只显示出s1的平均值

SELECT SID, AVG(SCORE) as AVG_SCORE FROM SC_XXX GROUP by SID;

select a.sid,avg(score) from sc a where .cid in (select c.cid from course c) group by a.sid ;

slect sid,avg(score) from sc group by sid

不知道你这个问题是否已经解决, 如果还没有解决的话:

如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^