So, as Shreyas mentioned, you can use the ‘row number’ function for the following use cases:
- To determine the top 10 selling products out of a large variety of products.
- To determine the top three winners in a car race.
- To find the top five areas in different cities in terms of GDP growth.
The main advantage of the ‘row number’ function over all the other types of rank functions is that it returns unique values. The syntax for writing the ‘row number’ function is as follows:
Let’s take a look at the demonstration of all the rank functions in the following video.
Now that you know how to use different rank functions in your query, it’s time to understand what the ‘partition by’ clause does in the multiple queries that you wrote. You will learn more about partitions in the next segment.
To learn more about the ‘row number’ function, you can refer to the link provided below.