Selecting n-th row
18. Create the ranking


Ok, we want to answer the following question: what is the name of the game with rank 2 in terms of best editor_rating? We create the SQL query to answer this problem in two steps.

In step 1, we create a ranking, just as we did in the previous section:

SELECT name,
  RANK() OVER(ORDER BY editor_rating DESC) AS rank
FROM game;

This step should be quite obvious now. Let's run it to confirm that it works.


Press Run and check code to run the template.