一道经典的sql语句题

2014-11-24 01:42:03 · 作者: · 浏览: 2

给一个班级成绩表 student (name,subject,score) ,

\

\

查询出所有总分数>600分的学员

select name,sum(score) from student group by name having sum(score)>600;
在总分大于零的基础上,去掉不及格的学员并按总分倒序排列。
select name,sum(score) s from student group by name having sum(score)>600 and min(score)>60 order by s desc;
找出有三科挂了的学员
select name from student  where score<60 group by name having count(name)>=3;