select a.sid,a.sname,count(b.cid),sum(b.score)
from Student as a
left join SC as b on a.sid=b.sid
group by sid,sname;
Student表:
sc表:
Teacher:
Course表:
select a.sid,a.sname,count(b.cid),sum(b.score)
from Student as a
left join SC as b on a.sid=b.sid
group by sid,sname;
Student表:
sc表:
Teacher:
Course表: