来个大牛写SQL语句 3张表联合查询(今天笔试遇到的)

学生表 课程表 成绩表

查询出所有课程总分大于200的学生姓名和课程数

select a.id,
a.studentName,
sum(c.score) totalScore,
count(b.id) coursesNum
from student a,courses b,scores c
where a.studentId=b.studentId
and b.studentId=c.studentId and b.coursesId=c.coursesId
group by a.id.a.studentName
having(sum(c.score)>200);