查詢最高成績的sql
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資料庫中供應商來自哪些州的哪些城市,如下圖所示。