Brief discussion on Row_number () over () analysis function usage ____ static function in Oracle

Source: Internet
Author: User

Sort functions in Groups

Row_number () over (partition by col1 ORDER by col2) is grouped according to col1, sorted by col2 within the group, and the value of this function represents the sequential number of the internal sort in each group (a sequential unique within the group).


The difference between the rownum and the rownum is that the result set is first sorted by adding a fake rownum and then sorted, and the function is sorted before the line number is counted after the sort clause is included.


Row_number () is about the same as rownum, which is a bit more powerful (you can sort from 1 in each group).
Rank () is a jump sort, with two second names followed by fourth place (also within each group)
Dense_rank () is also a sequential sort, with two second names still followed by third. In contrast, there is no duplicate value for row_number.

Related Article

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.