1.row_number () is the line number
2.rank: Similar to Row_number, except that it processes the order by field, and if the field value is the same, the line number remains unchanged
3.dense_rank: Similar to rank, the difference is whether the row number retains a position, and rank retains the position, that is, the row's value is changed from 1 to 3, because its 1 appears two times, so it retains a position for 2, and Dense_ Rank does not retain the 2 position, that is, the implementation of line number 2 is actually ranked in the 3rd place
The 4.ntile function can be used to group ordinal numbers. This is equivalent to putting the queried recordset into an array of a specified length, with each array element holding a certain number of records. The ordinal number generated by the Ntile function for each record is the index of all the array elements in this record (starting at 1). You can also refer to each array element of an allocation record as a "bucket." The Ntile function has an argument to specify the number of buckets.
Usage of row_number,rank,dense_rank,ntile ranking function in SQL Server