select a.s# ,a.sname,
sum(decode(c.cname,'语文',s.score,0)),
sum(decode(c.cname,'数学',s.score,0)),
sum(decode(c.cname,'英语',s.score,0)),
avg(s.score)
from stu a,cou c,sc s where a.s# = s.s# and c.c# = s.c#
group by a.s#,a.sname order by avg(s.score) desc