當前位置:首頁 » 編程語言 » 查詢最高成績的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資料庫中供應商來自哪些州的哪些城市,如下圖所示。

熱點內容
java返回this 發布:2025-10-20 08:28:16 瀏覽:585
製作腳本網站 發布:2025-10-20 08:17:34 瀏覽:881
python中的init方法 發布:2025-10-20 08:17:33 瀏覽:574
圖案密碼什麼意思 發布:2025-10-20 08:16:56 瀏覽:761
怎麼清理微信視頻緩存 發布:2025-10-20 08:12:37 瀏覽:677
c語言編譯器怎麼看執行過程 發布:2025-10-20 08:00:32 瀏覽:1005
郵箱如何填寫發信伺服器 發布:2025-10-20 07:45:27 瀏覽:250
shell腳本入門案例 發布:2025-10-20 07:44:45 瀏覽:108
怎麼上傳照片瀏覽上傳 發布:2025-10-20 07:44:03 瀏覽:799
python股票數據獲取 發布:2025-10-20 07:39:44 瀏覽:705