Leetcode Problem 2377. Sort the Olympic Table

2377. Sort the Olympic Table

Leetcode Solutions

Sorting Olympic Medal Standings

  • Start by selecting all columns from the Olympic table.
  • Use the ORDER BY clause to sort the results first by gold_medals in descending order.
  • Then sort by silver_medals in descending order.
  • Next, sort by bronze_medals in descending order.
  • Finally, sort by country in ascending order to break any ties.
  • The sorted result will reflect the Olympic medal standings according to the specified rules.

erDiagram
    OLYMPIC {
        string country PK
        int gold_medals
        int silver_medals
        int bronze_medals
    }

Ask Question

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

Suggested Answer

Answer
Full Screen
Copy Answer Code
Loading...