當前位置:首頁 » 編程語言 » 查詢最高成績的sql

查詢最高成績的sql

發布時間: 2023-06-10 06:24:45

A. sql在成績表裡查詢最高成績,最低成績,按課程號算出平均成績,要求降序排列

sql在成績表裡查詢最高成績,最低成績,按課程號算出平均成績,要求降序排列
select max(成績),min(成績) from 成績表 select avg(成績) as 平均成績 from 成績表 group by 課程號 order by 平均成績

B. sql語句查詢成績最高的學生

select * from 學生表 where 學生id in (select 學生id from 分數表 where 分數值 = (select Max(分數欄位) from 分數表)),這樣查詢即可。

C. SQL查詢單科成績最高的同學

SELECT child.abc,child.cource,a.name

FROM (select max(b.point) as abc,c.cource from `student` as a join `achievement` as b join `course` as c on a.sex = 1 and b.sid=a.id and b.cid=c.id group by c.cource) as child

join `student` as a join `achievement` as b join `course` as c on a.sex = 1 and b.sid=a.id and b.cid=c.id where child.abc=b.point and child.cource=c.cource

很繁瑣,子查詢和查詢的都是同一個表同一個條件,答案包對

不要姓名要學號的話就把名字換一下

原理

子查詢出最高分和科目,再用父查詢把(同條件下)把最高分和科目配對

D. SQL語句查詢每個學生的學號、姓名、平均成績、最高成績和最低成績

select 學生表.學號,學生表.姓名,
average(成績表.成績) as 平均成績,
max(成績表.成績) as 最高成績,
min(成績表.成績) as 最低成績
from 學生表 left join 成績表 on 學生表.學號=成績表.學號
order by 學生表.學號
成績表可換成語文、數學、英語等,查詢結果就是各個學生相應課程的平均成績、歷史最高成績、歷史最低成績.

E. 請問SQL 查詢出成績最高分

請問SQL 查詢出成績最高分
select 姓名,課程名,成績 from tablename where 成績=(select max(成績) from tablename)

F. 試寫一個SQL語句,查詢出各科成績最高分的同學(包括學生號,科目與成績)

select top 10 學生號列,成績列,科目列 from 表 where 科目列=科目 order by id desc,成績 desc
某個科目的前面最高分的10位同學
以此類推.要查哪個科目就改下科目就行了

G. sql,查詢每門課程最高分的學生的學號,課程號,成績。再一張表裡

1、首先在打開的sql中,查看Market資料庫中供應商來自哪些州的哪些城市,如下圖所示。

熱點內容
php房產網 發布:2025-02-13 18:18:06 瀏覽:86
源碼資源吧 發布:2025-02-13 18:14:39 瀏覽:79
java培訓價錢 發布:2025-02-13 17:59:33 瀏覽:974
c語言中變數類型 發布:2025-02-13 17:52:20 瀏覽:258
ftp導出報錯 發布:2025-02-13 17:41:20 瀏覽:997
腳本下載教程 發布:2025-02-13 17:39:06 瀏覽:235
解壓密碼re 發布:2025-02-13 17:39:02 瀏覽:558
linuxdump內存 發布:2025-02-13 17:37:30 瀏覽:57
游戲客戶端源碼 發布:2025-02-13 17:37:19 瀏覽:594
win7打開文件夾聲音 發布:2025-02-13 17:35:03 瀏覽:606