Documentation Index
Fetch the complete documentation index at: https://docs.oxla.com/llms.txt
Use this file to discover all available pages before exploring further.
Overview
TheNTILE() function is a window function used to divide an ordered data set into a specified number of approximately equal groups or buckets. This function assigns each group a bucket number starting form one.
Syntax
The syntax for this function is as follows:Parameters
bucket: positive integer or an expression that evaluates to a positive integer for each partition. It specifies the number of groups into which the data should be divided.
Restrictions
buckets: its value must be a positive integer. If it is a non-integer constant, it will be truncated to an integer.
Example
For the needs of this section we will use a simplified version of thefilm table from the
Pagila database, that will contain only the title, length and rating columns.
NTILE() function to divide the films into four quartiles based on their length: