现有学生表,课程表和成绩表,三表中的字段如下:
student表:id,student_name
course表:id,course_name
score表:student_id,course_id,score
前提:每个学生都会参加多门课程的考试,每门课程的成绩在score表中都是一条数据
现若要查询出 平均分在60分以上的学生id和学生姓名以及平均分,以下哪个sql语句是正确的? ()
A.select student_id,student_name,avg(score) av from student s join score sc on s.id=sc.student_id;
B.select student_id,student_name,avg(score) av from student s join score sc on s.id=sc.student_id where av>60;
C.select student_id,student_name,avg(score) av from student s join score sc on s.id=sc.student_id where av>60 group by student_id;
D.select student_id,student_name,avg(score) av from student s join score sc on s.id=sc.student_id group by student_id having av>60;