What is Width_bucket and how it is use full ?
What is Width_bucket and how it is use full ?
Width_bucket:-
===============
This function groups rows of the result set into buckets,but it attempts to create equiwidth buckets.this function can work on numeric or date data type,and takes 4 parameters. A)expression that generate the buckets. B)the value used as the start of the range of bucket no 1. C)the value used as the end of the range of bucket no n. D)the number of buckets to create(n).
Sample query #1 ----------------sample query #2 ----------------Code:select deptno,empno,sum(sal) salary,width_bucket(sum(sal),1,3000,3)sal_bucket from emp group by deptno,empno order by sal_bucket;Code:select deptno,empno,sum(sal) salary,width_bucket(sum(sal),1000,6000,3) sal_bucket from emp group by deptno,empno order by sal_bucket;