 |
RANKING FUNCTIONS
Rank()
Dense_Rank()
NTile()
Row_Number()
Each of these uses the OVER Clause to set up the query.
The coolest of these in my opinion is the NTILE
function as it
will divide up a result set into value bands producing an auto-
matic set of categories. In the sample below 4 price ranges would
be created.
SELECT NTILE(4) OVER(Partition BY PRODUCT.NAME ORDER BY PRICE) as
PRICERANGE, PRODUCT.NAME, PRICE
FROM PRODUCT
|
 |