感觉还是好难,第一道题看了半天愣是没有看懂什么意思???
这里的有效平均分,是指你那三门课程中有可能至少有一门课是0分
这里的有效课程,是值学生可能至少有一门课程没有学习
select a.S# as '学生ID',(select b.score from SC b,Course c where b.C#=c.C# and c.Cname='数据库' and a.S#=b.S#) as '数据库',
(select d.score from SC d,Course e where d.C#=e.C# and e.Cname='企业管理' and a.S#=d.S#) as '企业管理',
(select f.score from SC f,Course g where f.C#=g.C# and g.Cname='英语' and a.S#=f.S#) as '英语',
count(*) as '有效课程数',
avg(a.score) as '有效平均分' from SC a group by S# order by avg(a.score)