DENSE RANK()
與 RANK()
的相同。它返回排名沒有任何差距:
Select Studentid, Name,Subject,Marks,
DENSE_RANK() over(partition by name order by Marks desc)Rank
From Exam
order by name
Studentid Name Subject Marks Rank
101 Ivan Science 80 1
101 Ivan Maths 70 2
101 Ivan Social 60 3
102 Ryan Social 70 1
102 Ryan Maths 60 2
102 Ryan Science 50 3
103 Tanvi Maths 90 1
103 Tanvi Science 90 1
103 Tanvi Social 80 2