This is a discussion on Rank and Dense_Rank function within the Database Support forums, part of the Web Development category; Hi, Could any one explain about Rank and Dense_Rank function in sql...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| DENSE_RANK Returns the rank of rows within the partition of a result set, without any gaps in the ranking. The rank of a row is one plus the number of distinct ranks that come before the row in question. Syntax DENSE_RANK ( ) OVER ( [ < partition_by_clause > ] < order_by_clause > ) < partition_by_clause > Divides the result set produced by the FROM clause into partitions to which the DENSE_RANK function is applied. For the syntax of PARTITION BY, see OVER Clause < order_by_clause > Determines the order in which the DENSE_RANK values are applied to the rows in a partition. An integer cannot represent a column in the <order_by_clause> that is used in a ranking function.
__________________ Shaalini.S ![]() Be the Best of Whatever you are... |
| |||
| Return Types for Dense_Rank bigint If two or more rows tie for a rank in the same partition, each tied rows receives the same rank. For example, if the two top salespeople have the same SalesYTD value, they are both ranked one. The salesperson with the next highest SalesYTD is ranked number two. This is one more than the number of distinct rows that come before this row. Therefore, the numbers returned by the DENSE_RANK function do not have gaps and always have consecutive ranks. The sort order used for the whole query determines the order in which the rows appear in a result. This implies that a row ranked number one does not have to be the first row in the partition.
__________________ Shaalini.S ![]() Be the Best of Whatever you are... |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to get top rank | varghese | Search Engine Optimization | 22 | 03-02-2008 10:11 AM |
| Page Rank for given keyword | varghese | Search Engine Optimization | 15 | 10-25-2007 10:11 PM |
| Diff inline function and ordinary function | vigneshgets | C and C++ Programming | 1 | 05-24-2007 10:34 AM |
| Why it still has no page rank? | montyauto | Search Engine Optimization | 3 | 04-26-2007 10:59 PM |
| Yahoo rank | vadivelanvaidyanathan | Yahoo | 2 | 04-25-2007 06:13 AM |