Sqlrow_number, rank, dense_rank, ntile Functions

Source: Internet
Author: User
It is best to use row_number for sorting. It ranks in sequence and does not show the same rank, for example, 1, 2, 3, 4, or 5 rank, and skips the same rank number to the next, for example: 1, 1, 3, 4, 5, dense_rank appear in the same ranking, do not skip the same ranking number, such as: 1, 1, 2, 3, 4, ntitle () by the number of groups divided by value, such as: ntitel (3

It is best to use row_number for sorting. It ranks in sequence and does not show the same rank. For example, rank 1, 2, 3, 4, and 5 shows the same rank, and skips the same rank number to the next, for example: 1, 1, 3, 4, 5, dense_rank shows the same ranking, do not skip the same ranking number, such as: 1, 1, 2, 3, 4, ntitle () by the number of groups divided by value, such: ntitel (3

It is best to use row_number for sorting. It ranks in sequence and does not show the same rank, for example, 1, 2, 4, 5.

Rank has the same rank, and skips the next rank with the same rank number, such as, 5,

The same rank appears in dense_rank, and the same rank number is not skipped, such as:, 4,

Ntitle () sorts the number of groups divided by value, such as ntitel (3), and 3 based on: 1, the number of records in each group cannot be greater than the number of records in the previous group.
2. The records in all groups are either the same, or the number of records in all groups starting from a group is the same as the number of records in this group.

Both use with over orderby

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.