Check out example codes for "sql dense rank". It will help you in understanding the concepts better.

Code Example 1

#If you have a table with multiple entries per, for example, a client, 
#you can use dense rank to order either asc or desc to find the first or last one
#
SELECT A.ID_NUM,
A.CYCLE
FROM
(
SELECT
ID_NUM,
CYCLE,
DENSE_RANK() OVER (PARTITION BY ID_NUM ORDER BY CYCLE DESC) AS IDX
FROM TABLE
) A
WHERE IDX = 1

Learn ReactJs, React Native from akashmittal.com