题目:查询两门及其以上不及格课程的同学的学号,姓名及其平均成绩
分析:这个我想了半天,我的局限思维是一直在学生分数表 student_score 表中直接 分组 group by ,再去筛选分数
可以先筛选分数再 分组 并having count
sql 于下:
select student.id, student.stdentname, AVG(student_score.score) from student,student_score
where
student.id = student_score.studentid and student_score.score<60
group by student_score.studentid
having count(*)>1;