SQL: ROW_NUMBER(), RANK(), DENSE_RANK(), NTILE() RANKING FUNCTIONS
Read this post on webcodeexpert.com