Let Us Learn Oracle - Part 11 of N [ Width_Bucket function in Oracle ]
Source table: tblPlayers
Syntax: Width_Bucket(Expression, Minimum,Maximum,Number)
Purpose: This function divides a given data set into buckets with an equal interval size.
e.g. Marks = 35-59, 60-74, 75-89, 99-100
It is also known as 'equiwidth histogram'. The histogram range is divided into intervals that have identical size.It is like Ntile function which generates equiheight histograms.
SQL> Select PlayerID,BelongsTO,Width_Bucket(Sum(FeePerMatch),100,5000,10) Bucket From tblplayers Group By PlayerID,BelongsTO Order By PlayerID;
PLAYERID BELONGSTO BUCKET
---------- ---------- ----------
1 India 4
2 India 2
3 India 6
4 India 1
5 India 11
6 USA 11
7 USA 2
8 USA 11
9 USA 11
10 USA 11
10 rows selected.
Thanks for reading.