数据库最高分是哪个,数据库中查出表中最高到最低成绩的前3名的语句怎么写
来源:整理 编辑:黑码技术 2023-09-09 14:03:18
本文目录一览
1,数据库中查出表中最高到最低成绩的前3名的语句怎么写
最高成绩前3名:SELECT TOP 3 score FROM Marks ORDER BY score DESC(按成绩从高到低排列,取三位。) 最低成绩前3名:SELECT TOP 3 score FROM Marks ORDER BY score ASC
2,SQL查询平均成绩最高
select avg(字段) as cj from 表 order by cj descselect * from ( select avg(chengji) from student group by chengji)where rownum <= 1;select top 1 from ( select avg(成绩列)from 表名 )
3,my sql显示出科目的最高分且显示出得到最高分的科目
SELECT 科目,MAX(分数) AS 最高分 FROM 表名 GROUP BY 科目你先去www.mysql.com下载一个驱动. set adocon=server.createobject("adodb.connection") 创建实例 adocon.open"driver=连接数据库 driver 表示你用的驱动在系统控制面板的odbc里面查提到,和mssql一样的 database ===你的数据库 uid=====你的用户名 pwd===密码 option===可以不要
4,请问SQL 查询出成绩最高分
select 课程,姓名,成绩 from 表名 compute max(成绩) by 课程最高分 select * from student where 分数= ( select max(分数) from [student] ) 最低分 select * from student where 分数= ( select min(分数) from [student] )请问SQL 查询出成绩最高分select 姓名,课程名,成绩 from tablename where 成绩=(select max(成绩) from tablename)select max(成绩) from tablegroup by 课程应该是这样的,我没装SQL, 不能测试select 课程 ,姓名,max(成绩) as 成绩 from 表名 group by 课程 ,姓名select max(成绩) from 表名 group by 课程
5,oracle查找最高成绩的sql求救
3nbsp;selectnbsp;count(1),cnonbsp;fromnbsp;scnbsp;wherenbsp;gradenbsp;amp;gt;=nbsp;90nbsp;groupnbsp;bynbsp;cnonbsp;4nbsp;selectnbsp;cno,(selectnbsp;cnamenbsp;fromnbsp;cnbsp;wherenbsp;cnonbsp;=nbsp;tt.cno)nbsp;asnbsp;cnamenbsp;fromnbsp;(selectnbsp;cnonbsp;fromnbsp;scnbsp;ordernbsp;bynbsp;gradenbsp;wherenbsp;rownumnbsp;amp;lt;=nbsp;10)nbsp;ttnbsp;当然这个sql需要你保证c表的cno是pknbsp;--------nbsp;对补充的条件可以知道只要这个学生的最小分数在90分以上就行了nbsp;selectnbsp;count(1),cnonbsp;fromnbsp;scnbsp;wherenbsp;gradenbsp;amp;gt;=nbsp;90nbsp;andnbsp;cnonbsp;innbsp;(selectnbsp;cnonbsp;fromnbsp;scnbsp;havingnbsp;min(grade)nbsp;amp;gt;=nbsp;90nbsp;groupnbsp;bynbsp;cno)nbsp;groupnbsp;bynbsp;cnonbsp;那个having条件我也不知道那么写对不对……不行的话外面再套一层select吧orz3 select count(1),cno from sc where grade >= 90 group by cno 4 select cno,(select cname from c where cno = tt.cno) as cname from (select cno from sc order by grade where rownum <= 10) tt 当然这个SQL需要你保证c表的cno是PK -------- 对补充的条件可以知道只要这个学生的最小分数在90分以上就行了 select count(1),cno from sc where grade >= 90 and cno in (select cno from sc having min(grade) >= 90 group by cno) group by cno 那个having条件我也不知道那么写对不对……不行的话外面再套一层select吧orz
文章TAG:
数据库最高分是哪个 数据库中查出表中最高到最低成绩的前3名的语句怎么写