查询两门及其以上不及格课程的同学的学号,姓名及其平均成绩 从SC表中选取score小于60的,并group by sid,having count 大于1
SELECT st.sid,st.sname,avg(s.score) from student st INNER join sc s on st.sid = s.sid where s.sid in(
SELECT s1.sid from sc s1 where s1.score<60 group by s1.sid having count(1)>=2) group by s.sid;