select 姓名, SUM(case 课程 when '语文' then 分数 else 0 end) as 语文, SUM(case 课程 when '数学' then 分数 else 0 end) as 数学, SUM(case 课程 when '物理' then 分数 else 0 end) as 物理 from scores group by 姓名