Leetcode Problem 178. Rank Scores

178. Rank Scores

Leetcode Solutions

Ranking Scores Using DENSE_RANK() Window Function

Algorithm

  1. Use the SELECT statement to choose the columns score and the DENSE_RANK() function.
  2. Apply the DENSE_RANK() function over the window defined by ordering the scores in descending order using the OVER() clause.
  3. Alias the result of the DENSE_RANK() function as 'rank'.
  4. Use the FROM clause to specify the Scores table as the source of the data.
  5. Use the ORDER BY clause to sort the final result set by score in descending order.

erDiagram
    Scores {
        int id PK
        decimal score
    }

Ranking Scores Using a Correlated Subquery

Ask Question

Programming Language
image/screenshot of info(optional)
Full Screen
Loading...

Suggested Answer

Answer
Full Screen
Copy Answer Code
Loading...