NTILE of oracle analysis functions

Source: Internet
Author: User


The NTILE function of the oracle analysis function divides the ordered result set in a data partition, groups it into buckets, and assigns a unique group number to each group. This function is useful in statistical analysis. For example, if you want to remove outliers, You can group them into buckets at the top or bottom, and then exclude these values during statistical analysis. ORACLE Database statistics collection also uses the NTILE function to calculate the histogram information boundary. In statistical terms, the NTILE function creates an equal-width histogram. Statement used to create a table in tables: SQL code create table small_mers MERs (CUSTOMER_ID NUMBER, SUM_ORDERS NUMBER); insert into SMALL_CUSTOMERS (CUSTOMER_ID, SUM_ORDERS) values (1000, 10); insert into SMALL_CUSTOMERS (CUSTOMER_ID, SUM_ORDERS) values (1000, 20); insert into SMALL_CUSTOMERS (CUSTOMER_ID, SUM_ORDERS) values (1000, 30); insert into SMALL_CUSTOMERS (CUSTOMER_ID, SUM_ORDERS) values (800, 5 ); insert into small_mers MERs (CUSTOMER_ID, SUM_ORDERS) values (800, 10); insert into SMALL_CUSTOMERS (CUSTOMER_ID, SUM_ORDERS) values (800, 1); www.2cto.com usage: SQL code select customer_id, sum_orders, ntile (3) over (order by sum_orders) ntile from small_customers t;
The NTILE function is useful in practical applications such as dividing the total workload in N parallel processes. Let's assume that you have 3 parallel processes, you can divide the workload into three buckets and place each bucket in one process.

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.