select studentId,studentName,(select score from student where subject='语文') 语文分数,(select score from student where subject='数学') 数学分数,(select score from student where subject='英语') 英语分数,sum(score) 总分 from student group by studentName;
SELECT
studentName,
max(CASE subject WHEN '语文' THEN score END ) as '语文',
max(CASE subject WHEN '数学' THEN score END ) as '数学',
max(CASE subject WHEN '英语' THEN score END ) as '英语'
FROM
student
GROUP BY studentName
```