Understanding DENSE_RANK in SQL