NTile Functions - Microstrategy Desktop

seen from Maldives

seen from United States
seen from Spain
seen from United States
seen from China
seen from United States

seen from United States

seen from United States

seen from Greece
seen from Russia

seen from Russia
seen from Austria
seen from United States

seen from Singapore

seen from France

seen from United States

seen from United States

seen from Switzerland
seen from Switzerland
seen from Switzerland
NTile Functions - Microstrategy Desktop
New Post has been published on Varinder Sandhu 's Blog
New Post has been published on http://www.varindersandhu.in/2011/09/22/sql-server-ranking-functions-rank-dense_rank-row_number-ntile/
SQL Server - Ranking Functions - RANK, DENSE_RANK, ROW_NUMBER, NTILE
Ranking functions return a ranking value for each row in a partition. Depending on the function that is used, some rows might receive the same value as other rows. Ranking functions are nondeterministic.
There are four functions
RANK
DENSE_RANK
ROW_NUMBER
NTILE
RANK
<!-- google_ad_client = "pub-2404605494811633"; google_alternate_color = "FFFFFF"; google_ad_width = 468; google_ad_height = 60; google_ad_format = "468x60_as"; google_ad_type = "text_image"; google_ad_channel =""; google_color_border = "FFFFFF"; google_color_link = "0000FF"; google_color_bg = "FFFFFF"; google_color_text = "000000"; google_color_url = "008000"; google_ui_features = "rc:6"; //-->
Returns the rank of each row within the partition of a result set. The rank of a row is one plus the number of ranks that come before the row in question.
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.
ROW_NUMBER
Returns the sequential number of a row within a partition of a result set, starting at 1 for the first row in each partition.
NTILE
Distributes the rows in an ordered partition into a specified number of groups. The groups are numbered, starting at one. For each row, NTILE returns the number of the group to which the row belongs.
Difference between the RANK and DENSE_RANK
RANK leaves gaps while ranking the records whereas DENSE_RANK doesn’t leave any gaps and always have consecutive ranks.
So may you have questioned which one to use?
It’s all depends on your requirement and business rule you are following.
Choice between RANK and DENSE_RANK depends on the business rules you are following. As mentioned above RANK leaves gaps while ranking the records whereas DENSE_RANK doesn’t leave any gaps.
ROW_NUMBER to be used only when you just want to have the serial number on result set.
NTILE to be used when you want to distributes the rows in an ordered partition into a specified number of groups.
For more details you can refer the MSDN
NTILE in SQL
NTILE() is SQL function which is used for distributes the result set into specified number of ordered partitions. This is very useful while distributing the result set into multiple groups in case you need to distribute the results into multiple tables.
N…
View Post