SQL数据库:查询课程号为“203402”的成绩最高的前5名学生的学号及成绩,结果按成绩降序

(选课表sc的三个列名:学号SNO,课程号CNO,成绩GRADE)
2024-11-22 19:43:20
推荐回答(3个)
回答1:

--不明白随时问我
select SNO,成绩 from (
select SNO,成绩,row_number() over (order by 成绩 desc)*1 bz from tbname where CNO='203402') aa where aa.bz<=5
order by 成绩 desc

回答2:

select top 5 CNO,GRADE from sc where SNO=“203402” order by GRADE desc,试一下看是不是这样的。

回答3:

select * from (select top 5 sno,grade from sc where cno='203402' order by grade ) order by grade desc