sql查詢總成績排前三的學生 oracle用SQL語句查詢成績的前三名(重復的)?
oracle用SQL語句查詢成績的前三名(重復的)?先排序取最大的三個分數(shù),再用子查詢的三個分數(shù)聯(lián)表成績表不就OK了. 注意在取三個最大分數(shù)時用關(guān)鍵字排除重復項. SQL語句如何查詢成績的前三名帶成績
oracle用SQL語句查詢成績的前三名(重復的)?
先排序取最大的三個分數(shù),再用子查詢的三個分數(shù)聯(lián)表成績表不就OK了. 注意在取三個最大分數(shù)時用關(guān)鍵字排除重復項.
SQL語句如何查詢成績的前三名帶成績重復的?
select * from table where 成績 in (select top 3 distinct 成績 from table order by 成績 desc) order by 成績 desc 下面這個效率要高點 select * from table where 成績 >= (select min(成績) from(select top 3 distinct 成績 from table)) order by 成績 desc
用sql語句,查詢每個班級成績排名前三名的學生姓名?
不知道你是什么數(shù)據(jù)庫
如果是sqlserver呢,就用top:
selecttop20
成績
from表orderby
成績desc
如果是oracle呢,就用rownum:
select成績from表whererownum
用Sql查詢男女成績各前三名?
select * from (select * from student s where s.sex="男" order by s.score desc) where rownum
SQL(oracle)寫出查詢出每個班級里分數(shù)高的前三名?
select *
(select name,rank() over(partition by class order by score desc ) seq,class ,score
from t
) where seq
SQL語句查詢成績排名前十名的學生?
SELECT*FROM(SELECT班級,姓名,SUM(分數(shù))總分數(shù),ROW_NUMBER()OVER(PARTITIONBY班級ORDERBYSUM(分數(shù))DESC)班級名次FROM表名GROUPBY班級,姓名)TWHERE班級名次<=10ORDERBY班級,班級名次