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 70 2
101 Ivan Science 80 1
101 Ivan Social 60 3
102 Ryan Maths 60 2
102 Ryan Science 50 3
102 Ryan Social 70 1
103 Tanvi Maths 90 1
103 Tanvi Science 90 1
103 Tanvi Social 80 3