select s.sno, s.sname, count(sc.cno), sum(score)
from sc
left join course c on sc.cno = c.cno
right join student s on sc.sno = s.sno
group by s.sno, s.sname;
注意:设计到多表关系整理的时候,需要你把握: 1、关键表;2、1对1,和1对多得关系;
select s.sno, s.sname, count(sc.cno), sum(score)
from sc
left join course c on sc.cno = c.cno
right join student s on sc.sno = s.sno
group by s.sno, s.sname;
注意:设计到多表关系整理的时候,需要你把握: 1、关键表;2、1对1,和1对多得关系;