写一个 sql,查询一个班级里各科分数最高的学生信息
select b.* from (select subject,max(score) m from grade GROUP BY subject) t,grade b where t.subject=b.subject and t.m=b.score
用一句SQL查出所有课程成绩最高和最低的学生及其分数
select b.,“最高分” from (select subject,max(score) m from grade GROUP BY subject) t,grade b where t.subject=b.subject and t.m=b.score
UNION
select b.,“最低分” from (select subject,min(score) m from grade GROUP BY subject) t,grade b where t.subject=b.subject and t.m=b.score