A RANK() Returns the rank of each row in the result set of partitioned column.
Eg :
Select Studentid,Name,Subject,Marks,
RANK() over(partition by name order by Marks desc)Rank
From Exam
order by name,subject
Studentid Name Subject Marks Rank
101 Ivan Maths ...