查詢最高成績的sql
❶ 用SQL選出每個人成績的最高紀錄
SELECT 工號,max(成績) as 最高成績
from 成績表
group by 工號
❷ sql查詢總成績最高的是誰
請問SQL 查詢出成績最高分
select 姓名,課程名,成績 from tablename where 成績=(select max(成績) from tablename)
❸ sql查詢數學成績最高的人的信息
select * from 學生表 where
學號 in (select top 1 學號 from 成績表 where
課程號 in (select 課程號 from 課程表 where 課程名='數學') order by 分數 desc)
註:題目沒給出具體的表專名及欄位名稱,調試時屬請根據情況變更表名及欄位名。
❹ SQL查詢每課成績最高的學生的信息
大概思路是找出單科最高成績,再跟成績表關聯找出學生。
假設成績表有欄位科目ID、學生ID、學生成績三個欄位
大概以下SQL,可以參考下:
select 科目ID、學生ID、學生成績 b.最高成績 from 成績表 a
left join
(select 科目ID,max(學生成績) as 最高成績 from 成績表 group by 科目ID) b
on (a.科目ID=b.科目ID and a.學生成績=b.最高成績)
where b.最高成績 is not null;
❺ SQL查詢平均成績最高
select * from
(
select avg(chengji) from student
group by chengji
)
where rownum <= 1;
❻ 每個學生有不同成績,sql查詢最高成績的排名
1.每個學生可以是參加了一次或者多次的考試,對吧?
2.你是使用什麼資料庫?版MySQL?Oracle?SQLServer?
3.若學生中權最高的成績都是相同的分數,如何排名?是給相同的名次還是依舊隨機增序的方式排序?
❼ sql查詢學生成績表最高分數
以下這些英文都是學生表的常用的,希望你能看懂
1,查詢選了所有課的學生版
select
sname
from
student
where
snum=(select
sc.snum
from
sc
where
sc.snum=student.snum
group
by
sc.snum
having
count(*)=n)
2.查詢不及格學權生姓名和掛科的科目
select
sname,cname
from
student,sc,course
where
sc.snum=student.snum
and
sc.cnum=course.cnum
and
score<60
3.查詢每個課程選修人數和掛科人數(這個比較復雜)
select
cname,count(不及格)as
選修人數,sum(不及格)as
不及格人數
from(select
cname,case
when
score<60
then
1
else
0
end
as
不及格
from
sc,student,course
where
sc.cnum=course.cnum
and
sc.snum=student.snum)as
abc
group
by
cname
❽ sql語句查詢所有的最高成績
select 姓名,成績 from table
where 成績 = (select max(成績) from table )
❾ SQL查詢語句: 查詢 每科目分數最高的5項(學生姓名,科目,分數)
應該沒辦法一次性出來,當然如果科目數有限的話可以這樣
select
*
top
5
from
表
where
科目版
=
『科權目1』
order
by
分數
desc
union
select
*
top
5
from
表
where
科目
=
『科目2』
order
by
分數
desc
union
select
*
top
5
from
表
where
科目
=
『科目3』
order
by
分數
desc