您的位置:首页 > 职场人生

面试-一道经典的sql语句题

2014-03-28 22:55 323 查看
给一个班级成绩表 student (name,subject,score) ,



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

select name,sum(score) from student group by name having sum(score)>600;
在总分大于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;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: