我的表结构student_info| id |name |profession|score||--|--|--|--||id|姓名|分数|专业|

按分数段统计

400到500人数,300到400人数selectcount(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到400from student_info;

按分数段和专业统计

400到500人数,300到400人数selectcount(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到400from 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());

输出sqlselect 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视频教程,地址:https://www.php.cn/course/list/51.html

mysql显示各专业总人数_mysql实现每个专业分数段统计人数相关推荐

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

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

  2. C语言按各科分数段统计人数,(更新啦)学校学生成绩统计通用模板(科目、分数、统计分数段等均可自定,班级数、学生人数不受限制)...

    更新说明: 1.增加了导入.导出数据功能. 2.该功能可以实现版本更新时不用手动复制数据,可实现一键导入导出. 导语微信号☞gdpc-service 这是一款适用于学校平时统一考试成绩统计表.这是长期 ...

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

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

  4. 用函数统计各分数段人数c语言,如何使用Excel函数统计各或分数段的人数(五种方法).doc...

    Excel教程:妙用Excel五个函数统计学生期末考试分数段 考试结束,老师们都要对学生的考试成绩进行分析.各分数段人数的统计是其中一项必做的工作.在Excel中,怎样快速准确地统计分数段人数呢?以下 ...

  5. c语言如何统计不同分数段学生人数,Excel统计不同班级各个分数段的学生人数的方法...

    有很多人不了解Excel统计不同班级各个分数段的学生人数的方法,那么今天小编就在这里给大家分享一点我的小经验,希望可以给你们带来帮助. Excel统计不同班级各个分数段的学生人数的方法 如图所示,我们 ...

  6. c语言如何统计不同分数段学生人数,excel中如何统计不同班级各个分数段的学生人数...

    许多人在运用excel的时候,都只能简单的求和,求平均值,排序等,其实那些都是皮毛,excel中有许多高级的应用,学会后会让你快速对数据进行分析,统计.今天介绍的excel中如何统计不同班级各个分数段 ...

  7. 用c#算成绩的总和_c#编写一个学生成绩计算程序,统计出一个班学生的某门课程各分数段的人数(分数段:90分以上,80-90,70-80,...

    编写一个学生成绩计算程序,统计出一个班学生的某门课程各分数段的人数(分数段:90分以上,80-90,70-80,60-70,60分以下)成绩的计算方式是:平时成绩*40%+期末成绩*60%=最终成绩. ...

  8. 如何用Excel统计出各科指定分数段的人数?(亲测)

    当班级进行完一场考试后,当老师的你如何用Excel统计出各科指定分数段的人数?比如你想知道这次语文考试成绩高于90分的人数是多少,那么在Excel中该如何操作呢? 工具/原料 电脑(任意型号都可以) ...

  9. Excel 划分各分数段并统计各分数段的人数

    每当考试阅卷结束后,老师们都要对考试成绩进行统计,而统计各分数段人数是其中必不可少的一部分.那么怎么快速对各分数段人数进行统计呢?下面跟大家分享个简便的方法. 第一种方法 第一步: 先添加一个辅助列, ...

最新文章

  1. 架构师之路 — 分布式系统 — 分布式一致性难题
  2. bzoj 1975: [Sdoi2010]魔法猪学院 [k短路]
  3. kafka一键启动集群
  4. 计算机世界的虚拟机,容器和医学界的人工硬脑膜
  5. django学习笔记之forloop
  6. 【JS 逆向百例】转变思路,少走弯路,X米加密分析
  7. linux下ORACLE之RAW创建
  8. Apache Kylin 入门 1 - 基本概念
  9. AI+一统互联网和物联网
  10. 记一次CAN报文过滤器组调试过程
  11. unlink函数 与 remove函数
  12. 数据同步,数据库实时迁移同步方案,数据库同步软件
  13. JIRA消息通知打通钉钉群
  14. EOF和feof()区别
  15. 配音赚钱的软件有哪些 ?推荐以下这3个平台
  16. 北理工乐学C语言 60.合并排序
  17. java memcached incr_Memcached incr 与 decr 命令
  18. 研报实现——抓“妖股”就那么容易吗?
  19. Dalvik smali语法
  20. [热门游戏]今年“金酷”推出暗黑大作“魔界2”,邀你一起去探险。

热门文章

  1. linux防火墙封禁端口段
  2. 1.5 数学鲜花遍地开,课程改革微积分
  3. 从0基础学习MySQL数据库(三)
  4. YTUoj 1004: 1, 2, 3, 4, 5...
  5. AutoCAD VAB使用SendCommand命令
  6. 利用HTML、CSS、JS和Swiper插件实现抖音视频滑动功能
  7. This custom view should extend android.support.v7.widget.AppCompatTextView instead
  8. php ajax返回值会打印出来,ajax返回值有php字符
  9. Linux中./configure、make、make install详解
  10. Listen1音乐下载