https://www.cnblogs.com/WangShuaishuai/p/9407917.html
select student,
sum(case course when '语文' then score end) as '语文',
sum(case course when '数学' then score end) as '数学',
sum(case course when '英语' then score end) as '英语'
from 分数表
group by 学生表
学习了 ,SQL 行转列
还有pivot可以实现,可以自学下。