写一个 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
该博客介绍了如何使用SQL查询语句从成绩表中获取每个科目最高分和最低分的学生信息。通过UNION操作,分别展示了查询最高分和最低分的SQL片段,帮助理解SQL在数据查询中的应用。
4506

被折叠的 条评论
为什么被折叠?



