我的表结构

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. 关于SSL配置的报告
  2. mysql存储过程语法及实例
  3. 简化 MongoDB 关联运算
  4. 手把手玩转win8开发系列课程(18)
  5. VTK:AnatomicalOrientation解剖定位用法实战
  6. 基于CAS的低时延队列实现(原理示例)
  7. Leetcode每日一题:52.N-Queens II(N皇后Ⅱ)
  8. 小程序对实体行业转型有何影响?
  9. SENT协议译码的深入探讨
  10. Windows下本地安装SVN客户端
  11. 简聊聊天软件的表设计
  12. [Python爬虫] 简单网络爬虫抓取博客文章及思想介绍
  13. 提示此windows副本不是正版的win7系统7601解决方法
  14. 笔记本升级--固态硬盘安装双系统win10-CentOS
  15. 1_linux简介基础
  16. Vue 的属性、方法和生命周期
  17. 2017-5-11 公司客户考察篇
  18. 微信公众平台的运营管理
  19. mysql忘记密码问题
  20. 学计算机的目标作文,计算机学习计划作文三篇

热门文章

  1. ubuntu下安装goldendict及离线词库
  2. aop:aspectj-autoproxy 标签解析
  3. 易基因|动物发育过程中顺式调控区域的活性DNA去甲基化早于脊椎动物起源:重磅研究
  4. 私有云基础架构设计:存储、网络、计算、安全和应用的设计最佳实践及案例
  5. 说一说 oneway 吧,了解过这个修饰符作用吗?原理是什么?怎么理解单向调用?
  6. 读《Machine Learning in Action》的感想
  7. Molten 功能简介以及使用指南
  8. 【MTK 6737】Modem编译
  9. Entry name ‘res/color/material_on_surface_disabled.xml‘ collided
  10. php mysql orm_初探PHP ORM框架Doctrine