创建一个sc表并插入数据
方法一:
select distinct uid,
(select score from sc where s.uid=uid and course='语文')语文,
(select score from sc where s.uid=uid and course='数学')数学,
(select score from sc where s.uid=uid and course='英语')英语
from sc s;
方法二:
select * from sc where course='语文';
select * from sc where course='数学';
select * from sc where course='英语';把这三条数据当做三个表
select y.uid,y.score 语文,s.score 数学,e.score 英语
from (SELECT * FROM `sc` where course='语文') y
left join (SELECT * FROM `sc` where course='数学') s
on y.uid=s.uid
left join (SELECT * FROM `sc` where course='英语') e
on y.uid=e.uid;