題目:查詢兩門及其以上不及格課程的同學的學號,姓名及其平均成績
分析:這個我想了半天,我的局限思維是一直在學生分數表 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;