Note that the first four grade records are tied for the first place; therefore,
the record that follows the tied records has rank 5. With the dense_rank() all
134
SQL — The Relational Language
four tied records will have rank 1 and the record that follows will have rank 2.
This can be achieved by writing:
select stno, grade,
dense_rank() over (order by grade desc) as den_rank
from grades;
This query returns: