Dense_Rank(), Row_Number(), Rank() in sql server
select id,number,name ,DENSE_RANK() over(partition by number order by name ) as dense ,row_number() over(partition by number order by name ) as rownumber ,rank() over(partition by number order by name ) as ranks from dbo.dense_demo select * from dbo.dense_demo
get the below result: