RANK …OVER … PARTITION BY

Use the RANK function to rank, or number, the row results. If a partition is used the rank is the number of the row within the partition. RANK is used WITH TIES to assign the same rank value to tied results.

Syntax

RANK ( ) over ( [ PARTITION BY value_expression1, value_expression2, … ]  order by …)