欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

mysql如何統(tǒng)計每個專業(yè)分數段的人數

MySQL如何統(tǒng)計每個專業(yè)分數段的人數的呢?下面由創(chuàng)新互聯(lián)小編給大家詳細的介紹;

創(chuàng)新互聯(lián)公司專業(yè)為企業(yè)提供井陘網站建設、井陘做網站、井陘網站設計、井陘網站制作等企業(yè)網站建設、網頁設計與制作、井陘企業(yè)網站模板建站服務,10年井陘做網站經驗,不只是建網站,更提供有價值的思路和整體網絡服務。

1.我的表結構

student_info
| id |name |profession|score|
|--|--|--|--|
|id|姓名|分數|專業(yè)|

2.按分數段統(tǒng)計

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;

mysql如何統(tǒng)計每個專業(yè)分數段的人數

3.按分數段和專業(yè)統(tǒng)計

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;

mysql如何統(tǒng)計每個專業(yè)分數段的人數

4.sql動態(tài)拼接生成

  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());

5.輸出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如何統(tǒng)計每個專業(yè)分數段人數的詳細介紹,如果想了解更多請關注創(chuàng)新互聯(lián)其它相關文章!

當前文章:mysql如何統(tǒng)計每個專業(yè)分數段的人數
鏈接URL:http://www.aaarwkj.com/article40/gjipho.html

成都網站建設公司_創(chuàng)新互聯(lián),為您提供網站排名、全網營銷推廣、搜索引擎優(yōu)化、網站制作云服務器、Google

廣告

聲明:本網站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)

手機網站建設
未满十八禁止观看免费观看| 久久久久久国产综合精品| 日本高清精品视频在线| 欧美老熟妇一区三区精品| 国产丝袜肉丝在线播放| 久久久亚洲精品中文字幕蜜桃 | 亚洲国产日韩精品欧美| 日韩人成理论午夜福利| 人妻少妇麻豆中文字幕久久精品| 欧美丝袜熟女日韩亚洲| 91精品人妻一区二区| 日本精品一区二区不卡| 午夜影院网站在线看黄| 中文字幕日韩在线欧美一区| 韩日男人女人性生活视频| 亚洲欧美日韩精品区| 欧美香蕉一区二区视频| 中文字幕人妻久久精品一区| 成人av影视中文字幕| 高h视频在线播放观看| 欧美精品一区二区三区色| 丰满人妻在线一区二区三区| 国产情侣自拍在线观看| 亚洲成在人天堂一区二区| 国产成人综合久久三区北岛玲| 国产经典午夜福利在线| 欧美精品成人免费在线| 风流少妇奶真白摸的好爽| 国产精品视频一区二区久久| 亚洲av粉色一区二区三区| 麻豆一精品传二传媒短视频| 中文字幕av免费专区| 亚洲 综合 久久久| 青青草原一区在线观看| 97国产在线视频观看| 麻豆人妻少妇精品系列| 精品妇女一区二区三区| 91久久亚洲综合精品日本 | 亚洲一区二区在线视频在线观看 | 欧美性精品不卡在线观看| 亚洲精品小视频在线观看|