Figure 2: RANK() and DENSE_RANK() query result
orderid qty rnk drnk
30001 10 1 1
10001 10 1 1
10006 10 1 1
40005 10 1 1
30003 15 5 2
30004 20 6 3
20002 20 6 3
20001 20 6 3
10005 30 9 4
30007 30 9 4
40001 40 11 5