我的表结构

student_info

id name profession score
id 姓名 分数 专业

按分数段统计

400到500人数,300到400人数

select
count(case when score between 400 and 500 then 1 end) as 400到500,
count(case when score between 300 and 400 then 1 end) as 300到400
from student_info;

按分数段和专业统计

400到500人数,300到400人数

select
count(case when score between 400 and 500 then 1 end) as 400到500,
count(case when score between 300 and 400 then 1 end) as 300到400
from student_info GROUP BY profession;

sql动态拼接生成

  int start = 200;int end = 700;int inter = 10;int count = (end-start)/inter;StringBuilder sqlBuilder = new StringBuilder();sqlBuilder.append("select ");for(int i =1;i<=count;i++){int next = start+inter-1;System.out.println(start + " \t" + next);sqlBuilder.append(" count(case when admission_score between ").append(start).append(" and ").append(next).append(" then 1 end) as ").append(start).append("到").append(next);if(i!=count){sqlBuilder.append(", ");}start += inter;}sqlBuilder.append(" from z_student_info");System.out.println(sqlBuilder.toString());

输出sql

select  count(case when admission_score between 200 and 209 then 1 end) as 200到209,  count(case when admission_score between 210 and 219 then 1 end) as 210到219,  count(case when admission_score between 220 and 229 then 1 end) as 220到229,  count(case when admission_score between 230 and 239 then 1 end) as 230到239,  count(case when admission_score between 240 and 249 then 1 end) as 240到249,  count(case when admission_score between 250 and 259 then 1 end) as 250到259,  count(case when admission_score between 260 and 269 then 1 end) as 260到269,  count(case when admission_score between 270 and 279 then 1 end) as 270到279,  count(case when admission_score between 280 and 289 then 1 end) as 280到289,  count(case when admission_score between 290 and 299 then 1 end) as 290到299,  count(case when admission_score between 300 and 309 then 1 end) as 300到309,  count(case when admission_score between 310 and 319 then 1 end) as 310到319,  count(case when admission_score between 320 and 329 then 1 end) as 320到329,  count(case when admission_score between 330 and 339 then 1 end) as 330到339,  count(case when admission_score between 340 and 349 then 1 end) as 340到349,  count(case when admission_score between 350 and 359 then 1 end) as 350到359,  count(case when admission_score between 360 and 369 then 1 end) as 360到369,  count(case when admission_score between 370 and 379 then 1 end) as 370到379,  count(case when admission_score between 380 and 389 then 1 end) as 380到389,  count(case when admission_score between 390 and 399 then 1 end) as 390到399,  count(case when admission_score between 400 and 409 then 1 end) as 400到409,  count(case when admission_score between 410 and 419 then 1 end) as 410到419,  count(case when admission_score between 420 and 429 then 1 end) as 420到429,  count(case when admission_score between 430 and 439 then 1 end) as 430到439,  count(case when admission_score between 440 and 449 then 1 end) as 440到449,  count(case when admission_score between 450 and 459 then 1 end) as 450到459,  count(case when admission_score between 460 and 469 then 1 end) as 460到469,  count(case when admission_score between 470 and 479 then 1 end) as 470到479,  count(case when admission_score between 480 and 489 then 1 end) as 480到489,  count(case when admission_score between 490 and 499 then 1 end) as 490到499,  count(case when admission_score between 500 and 509 then 1 end) as 500到509,  count(case when admission_score between 510 and 519 then 1 end) as 510到519,  count(case when admission_score between 520 and 529 then 1 end) as 520到529,  count(case when admission_score between 530 and 539 then 1 end) as 530到539,  count(case when admission_score between 540 and 549 then 1 end) as 540到549,  count(case when admission_score between 550 and 559 then 1 end) as 550到559,  count(case when admission_score between 560 and 569 then 1 end) as 560到569,  count(case when admission_score between 570 and 579 then 1 end) as 570到579,  count(case when admission_score between 580 and 589 then 1 end) as 580到589,  count(case when admission_score between 590 and 599 then 1 end) as 590到599,  count(case when admission_score between 600 and 609 then 1 end) as 600到609,  count(case when admission_score between 610 and 619 then 1 end) as 610到619,  count(case when admission_score between 620 and 629 then 1 end) as 620到629,  count(case when admission_score between 630 and 639 then 1 end) as 630到639,  count(case when admission_score between 640 and 649 then 1 end) as 640到649,  count(case when admission_score between 650 and 659 then 1 end) as 650到659,  count(case when admission_score between 660 and 669 then 1 end) as 660到669,  count(case when admission_score between 670 and 679 then 1 end) as 670到679,  count(case when admission_score between 680 and 689 then 1 end) as 680到689,  count(case when admission_score between 690 and 699 then 1 end) as 690到699 from z_student_info

mysql 按分数段,每个专业分数段统计人数相关推荐

  1. mysql不同分数的人数,mysql如何统计每个专业分数段的人数

    mysql如何统计每个专业分数段的人数 发布时间:2020-03-20 15:02:26 来源:亿速云 阅读:532 作者:小新 mysql如何统计每个专业分数段的人数的呢?下面由亿速云小编给大家详细 ...

  2. mysql显示各专业总人数_mysql实现每个专业分数段统计人数

    我的表结构student_info| id |name |profession|score||--|--|--|--||id|姓名|分数|专业| 按分数段统计 400到500人数,300到400人数s ...

  3. mysql统计分数段人数_mysql 按分数段,每个专业分数段统计人数

    我的表结构 student_info | id |name |profession|score| |--|--|--|--| |id|姓名|分数|专业| 按分数段统计 400到500人数,300到40 ...

  4. 五邑大学专插本c语言试题_2019广东专插本各专业报考、录取人数、录取分数及平均分(二)...

    此前,为大家推送了2019年广东专插本招生院校(岭南师范学院.嘉应学院.韩山师范学院.肇庆学院和韶关学院)各专业报考.录取人数.录取分数及平均分.点击下方链接,查看详情: 2019广东专插本各专业报考 ...

  5. 北航计算机学院学硕分数,考研|北航各学院复试分数线陆续公布,原来这个专业分数最高!...

    原标题:考研|北航各学院复试分数线陆续公布,原来这个专业分数最高! 小萱说 继<北航2018年硕士研究生招生复试资格基本线及复试规定>出台后,各学院复试资格线也陆续公布,常有焦急的粉丝在后 ...

  6. 麻将AI超越99%人类玩家:专业十段,学习能力堪比阿法狗

    从最早的AI(人工智能)在国际象棋中战胜人类开始,中国象棋.德州扑克.围棋等智力游戏相继沦陷,在DOTA.星际争霸等电子游戏中也表现亮眼,但是AI在麻将领域却一直没有突破. 近日,微软发布了一份关于麻 ...

  7. 广西科技大学计算机专业分数,广西科技大学

    根据<自治区教育厅关于开展2021 年本科院校对口招收全区中等职业学校毕业生试点工作的通知>(桂教高教2021 24 号).<自治区招生考试院关于做好我区2021 年本科院校对口招收 ...

  8. 考研计算机网络安全专业,北京交通大学计算机考研分数,网络安全专业

    北京交通大学计算机考研分数,网络安全专业北京交大留学服务中心主要负责国外优质教育项目的引进,国际项目的人才培养和出国留学手续办理等工作.如何确定考研复试院校的规定和复试的时间.地点?每个学校根据教育部 ...

  9. mysql的回滚段_ORACLE 回滚段详解

    ORACLE 回滚段 回滚段概述 回滚段用于存放数据修改之前的值(包括数据修改之前的位置和值).回滚段的头部包含正在使用的该回滚段事务的信息.一个事务只能使用一个回滚段来存放它的回滚信息,而一个回滚段 ...

  10. 分数用计算机怎么分数除法,分数除法怎么算

    教学目标1.使学生掌握除法估算的方法,会进行两位数的除法估算.2.培养学生估算的意识,归纳概括.迁移类推的能力,以及应用所学知识灵活解决实际问题的能力.3.培养学生学习数学的兴趣,自主探索.勇于尝试的 ...

最新文章

  1. html 图片时钟,教你五步制作精美的HTML时钟
  2. ​2021年机器学习什么风向?谷歌大神Quoc Le:把注意力放在MLP上
  3. centos系统为php安装memcached扩展步骤
  4. 网络营销重点之如何了解用户需求完善网络营销策略
  5. 题目1251:序列分割(DFS+剪枝)
  6. LVS集群-DR负载均衡集群
  7. 广西师范大学计算机调剂难吗,2014年广西师范大学考研调剂过来人给的建议
  8. linux 下升级apache,CentOS6.5在已有低版本环境下安装升级Apache+MySQL+PHP,centos6.5apache...
  9. (2015-12-09)java.util.Arrays的用法
  10. Java 异步编程:从 Future 到 Loom
  11. MD5 32位加密算法源码(测试通过)(系转载 飞扬天下)
  12. [ci]jenkins server启动,通过jnlp的方式启动slave(容器模式)
  13. 牛客网-公司真题-买帽子
  14. CakePHP 2.x CookBook 中文版 第七章 模型 之 数据校验
  15. Ubuntu20.04基本配置和常见问题(vmwareTools配置、换源、网卡配置)
  16. 面试考知识点,吾亦很难通过
  17. WINDOWS下SQL2016安装
  18. notepad 快速新建html,notepad编写html
  19. 【STM8】STM8在STVD平台生成HEX和S19文件的方法
  20. go IO操作-文件写

热门文章

  1. 机器学习之过拟合与欠拟合
  2. Focal损失函数学习笔记
  3. oracle 时间函数介绍
  4. python爬虫自动更换ip_python爬虫:自动投票代码(自动爬取代理IP)
  5. 测判三极管的口诀 (挑战者)
  6. “满五唯一”和“满二唯一”是什么?有什么不同?
  7. vscode android调试,利用VSCode对react-native android项目进行调试时出现报错如何解决...
  8. 洛谷刷题C语言:CRNE、CETIRI、PRASE
  9. 蓝桥杯——鲁卡斯队列
  10. python正则匹配连续相同字符_正则表达式: 匹配n个相同连续字符