To paginate a list ("page 1 is rows 1-10") you need a stable, unique position for every row. Users must be numbered by age, youngest first, and when two users have the same age the one with the smaller id comes first, so the numbering never changes between runs.
Write a query returning name, age and the position as row_num using ROW_NUMBER().
name, age, row_numrow_num goes 1, 2, 3, ... with no repeatsage ascending, ties by id ascendingROW_NUMBER() OVER (ORDER BY ...) numbers rows in the given order.
Add id as a second sort key to make ties deterministic.
No results yet
Run your code to check it against the examples, or submit to run every test.