– 查询"01"课程比"02"课程成绩高的学生的信息及课程分数
SELECT
st.*,
sc.s_score AS '语文',
sc2.s_score AS '数学'
FROM
student st
LEFT JOIN score sc ON sc.s_id=st.s_id AND sc.c_id='01'
LEFT JOIN score sc2 ON sc2.s_id=st.s_id AND sc2.c_id='02'
WHERE sc.s_score>sc2.s_score