In general, the expression in the partition by clause divides the set of rows
that results from the query in groups and the rank() function operates within
these groups; in other words, rank() is reset when the defining expression of the
group changes. The order by clause attached to the rank specifies the ranking
criterion and the order of the rows in each group.