,
1.
这是一张班级的成绩表,想统计出每个成绩段的数据,mysql的sql语句该怎么写呢。
2条回答 默认 最新
- GrowingDarker 2015-12-01 02:44关注
select '60分以下' type, count(*) from student s where s.score < 60 union all select '60分以上70分以下' type,count(*) from student s where s.score < 70 and s.score > 60 union all select '70分以上80分以下' type,count(*) from student s where s.score < 80 and s.score > 70 union all select '80分以上90分以下' type,count(*) from student s where s.score < 90 and s.score > 80 union all select '90分以上' type,count(*) from student s where s.score > 90; 结果 +------------------+----------+ | type | count(*) | +------------------+----------+ | 60分以下 | 1 | | 60分以上70分以下 | 1 | | 70分以上80分以下 | 2 | | 80分以上90分以下 | 1 | | 90分以上 | 3 | +------------------+----------+
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 2无用
悬赏问题
- ¥15 程序不包含适用于入口点的静态Main方法
- ¥15 素材场景中光线烘焙后灯光失效
- ¥15 请教一下各位,为什么我这个没有实现模拟点击
- ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
- ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
- ¥20 有关区间dp的问题求解
- ¥15 多电路系统共用电源的串扰问题
- ¥15 slam rangenet++配置
- ¥15 有没有研究水声通信方面的帮我改俩matlab代码
- ¥15 ubuntu子系统密码忘记