sql分组和聚集
select st.name na,co.NAME name,sc.score from scores sc
left join students st on sc.sid = st.id
left join courses co on co.id=sc.cid
共9门课程,获取成绩未填满的学生:
select t.na,count(*) from
(select st.name na,co.NAME name,sc.score from scores sc
left join students st on sc.sid = st.id
left join courses co on co.id=sc.cid) t
group by t.na having count(*)<9;