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.