<span id="mktg5"></span>

<i id="mktg5"><meter id="mktg5"></meter></i>

        <label id="mktg5"><meter id="mktg5"></meter></label>
        最新文章專題視頻專題問答1問答10問答100問答1000問答2000關鍵字專題1關鍵字專題50關鍵字專題500關鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關鍵字專題關鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
        問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
        當前位置: 首頁 - 科技 - 知識百科 - 正文

        sql查詢最高分、最低分和平均分語句

        來源:懂視網 責編:小采 時間:2020-11-09 10:03:19
        文檔

        sql查詢最高分、最低分和平均分語句

        sql查詢最高分、最低分和平均分語句:sql 查詢最高分、最低分和平均分語句 //我們要用就以學生成績為實例吧 /* 結構 學生表 Student(S#,Sname,Sage,Ssex) --S# 學生編號,Sname 學生姓名,Sage 出生年月,Ssex 學生性別 --2.課程表 Course(C#,Cname,T#) --C# --課程編
        推薦度:
        導讀sql查詢最高分、最低分和平均分語句:sql 查詢最高分、最低分和平均分語句 //我們要用就以學生成績為實例吧 /* 結構 學生表 Student(S#,Sname,Sage,Ssex) --S# 學生編號,Sname 學生姓名,Sage 出生年月,Ssex 學生性別 --2.課程表 Course(C#,Cname,T#) --C# --課程編

        sql 查詢最高分、最低分和平均分語句
        //我們要用就以學生成績為實例吧
        /*
        結構

        學生表
        Student(S#,Sname,Sage,Ssex) --S# 學生編號,Sname 學生姓名,Sage 出生年月,Ssex 學生性別
        --2.課程表
        Course(C#,Cname,T#) --C# --課程編號,Cname 課程名稱,T# 教師編號


        */

        查詢各科成績最高分、最低分和平均分:以如下形式顯示:課程ID,課程name,最高分,最低分,平均分,及格率,中等率,優良率,優秀率
        --及格為>=60,中等為:70-80,優良為:80-90,優秀為:>=90
        --方法1
        select m.C# [課程編號], m.Cname [課程名稱],
        max(n.score) [最高分],
        min(n.score) [最低分],
        cast(avg(n.score) as decimal(18,2)) [平均分],
        cast((select count(1) from SC where C# = m.C# and score >= 60)*100.0 / (select count(1) from SC where C# = m.C#) as decimal(18,2)) [及格率(%)],
        cast((select count(1) from SC where C# = m.C# and score >= 70 and score < 80 )*100.0 / (select count(1) from SC where C# = m.C#) as decimal(18,2)) [中等率(%)],
        cast((select count(1) from SC where C# = m.C# and score >= 80 and score < 90 )*100.0 / (select count(1) from SC where C# = m.C#) as decimal(18,2)) [優良率(%)],
        cast((select count(1) from SC where C# = m.C# and score >= 90)*100.0 / (select count(1) from SC where C# = m.C#) as decimal(18,2)) [優秀率(%)]
        from Course m , SC n
        where m.C# = n.C#
        group by m.C# , m.Cname
        order by m.C#
        --方法2
        select m.C# [課程編號], m.Cname [課程名稱],
        (select max(score) from SC where C# = m.C#) [最高分],
        (select min(score) from SC where C# = m.C#) [最低分],
        (select cast(avg(score) as decimal(18,2)) from SC where C# = m.C#) [平均分],
        cast((select count(1) from SC where C# = m.C# and score >= 60)*100.0 / (select count(1) from SC where C# = m.C#) as decimal(18,2)) [及格率(%)],
        cast((select count(1) from SC where C# = m.C# and score >= 70 and score < 80 )*100.0 / (select count(1) from SC where C# = m.C#) as decimal(18,2)) [中等率(%)],
        cast((select count(1) from SC where C# = m.C# and score >= 80 and score < 90 )*100.0 / (select count(1) from SC where C# = m.C#) as decimal(18,2)) [優良率(%)],
        cast((select count(1) from SC where C# = m.C# and score >= 90)*100.0 / (select count(1) from SC where C# = m.C#) as decimal(18,2)) [優秀率(%)]
        from Course m
        order by m.C#

        聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

        文檔

        sql查詢最高分、最低分和平均分語句

        sql查詢最高分、最低分和平均分語句:sql 查詢最高分、最低分和平均分語句 //我們要用就以學生成績為實例吧 /* 結構 學生表 Student(S#,Sname,Sage,Ssex) --S# 學生編號,Sname 學生姓名,Sage 出生年月,Ssex 學生性別 --2.課程表 Course(C#,Cname,T#) --C# --課程編
        推薦度:
        標簽: 查詢 sql 平均
        • 熱門焦點

        最新推薦

        猜你喜歡

        熱門推薦

        專題
        Top
        主站蜘蛛池模板: 日本xxwwxxww在线视频免费| 最近免费中文字幕大全高清大全1| 在线观看免费a∨网站| 亚洲伊人久久大香线蕉| 又黄又爽又成人免费视频| 亚洲国产美女精品久久久久| 国色精品卡一卡2卡3卡4卡免费| 亚洲伊人久久精品| 日本黄页网站免费| rh男男车车的车车免费网站| 在线精品亚洲一区二区小说| 中文字幕免费不卡二区| 久久久久久亚洲AV无码专区 | 久久免费精品视频| 亚洲91av视频| 色影音免费色资源| 亚洲最大中文字幕无码网站| 国产免费无遮挡精品视频| 一区二区视频免费观看| 久久久久亚洲AV片无码| 99久久免费国产精品特黄| 国产精品亚洲天堂| 亚洲精品一品区二品区三品区| 91青青青国产在观免费影视| 亚洲国产夜色在线观看| 国产精品酒店视频免费看| 中国在线观看免费的www| 666精品国产精品亚洲| 成年女人看片免费视频播放器| 特级毛片aaaa级毛片免费| 亚洲国产精品无码专区在线观看| 91九色老熟女免费资源站| 免费看一级高潮毛片| 日韩亚洲AV无码一区二区不卡| 免费看www视频| 成人电影在线免费观看| 亚洲精品无码成人| 亚洲国产精彩中文乱码AV| 免费黄色大片网站| 免费的全黄一级录像带| 亚洲AV电影天堂男人的天堂|