It’s been a while since I’ve covered a SQL 201 topic! I want to jump back into it with ranking functions. These are functions that let you represent orders in your data. When you were in school I’m sure you had to take standardized tests. When you did you were given a percentile score. This score represented how you performed compared to all students in your sample. This sample group was everyone in your grade level. So if you were taking the end of course exams for 11th grade, you were compared with every other student in the 11th grade.
Percentile is just one of the four ranking functions you have available in SQL 2008 R2. I’m going to go over how and when you would use these in the real world. Let’s start with the easy stuff.