The role and usage of SQL over

Source: Internet
Author: User

the role and usage of SQL over rank () Over([Query_partition_clause]order_by_clause) Dense_rank () Over([Query_partition_clause]order_by_clause) enables sorting by the specified field grouping for the result set of the same grouping field, where partition byis a grouping field,ORDER  bySpecifies the sort field over cannot be used alone, to be used with analytic functions: Rank (), Dense_rank (), Row_number (), and so on. Its parameters: Over(Partition byColumnname1Order  bycolumnname2) Meaning: Sort by the field specified by Columname1, or by the value of the field columnname1. For example: In the Employees table, there are two records for the department: department_id = 10 andSelectDepartment_id,rank () Over(Partition bydepartment_idOrder  bySalary fromEmployees refers to the rank of salary in department 10, and the salary rank in department 20. If it's partition, byORG_ID is ranked throughout the company.

The role and usage of SQL over

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.