1:  
Select IsNull(语文,0) + isNull(数学,0) + IsNull(外语,0) as 总分,
(case when IsNull(语文,0) + isNull(数学,0) + IsNull(外语,0) = 0 then 0 else
(IsNull(语文,0) + isNull(数学,0) + IsNull(外语,0))/
((case when 语文 is null then 0 else 1 end) + (case when 语文 is null then 0 else 1 end)+(case when 语文 is null then 0 else 1 end)) end as 平均值
from 成绩表