Is it possible to calculate percentiles in sql as in excel? I have a range of scores and I would like to determine who is in the top 10%, mid 50%, etc.
Excel uses different calculations based on whether a given value is in the dataset or not. If you want to reproduce the same behavior in SQL, take a look at this article, they the formulas, description and example code: http://www.sqlmag.com/article/tsql3/calculate-percentiles Both approaches use rank/dense_rank functions.