101
0/304
Loading content...
An international sports analytics desk stores medal counts by country and needs a deterministic leaderboard for publishing and downstream reporting.
Table: MedalStandings
Task: Return the same rows sorted by ranking priority:
Output requirements:
Supported submission environments:
MedalStandings:
| country | gold_medals | silver_medals | bronze_medals |
|-------------|-------------|---------------|---------------|
| China | 10 | 10 | 20 |
| South Sudan | 0 | 0 | 1 |
| USA | 10 | 10 | 20 |
| Israel | 2 | 2 | 3 |
| Egypt | 2 | 2 | 2 |[
{"country":"China","gold_medals":10,"silver_medals":10,"bronze_medals":20},
{"country":"USA","gold_medals":10,"silver_medals":10,"bronze_medals":20},
{"country":"Israel","gold_medals":2,"silver_medals":2,"bronze_medals":3},
{"country":"Egypt","gold_medals":2,"silver_medals":2,"bronze_medals":2},
{"country":"South Sudan","gold_medals":0,"silver_medals":0,"bronze_medals":1}
]China and USA tie on all medal counts, so country name breaks the tie. Israel beats Egypt on bronze medals after gold and silver ties.
MedalStandings:
| country | gold_medals | silver_medals | bronze_medals |
|-------------|-------------|---------------|---------------|
| Aland | 5 | 4 | 3 |
| Borealis | 5 | 4 | 3 |
| Cyrenia | 5 | 4 | 2 |
| Dalmora | 6 | 0 | 0 |
| Estoria | 5 | 5 | 0 |[
{"country":"Dalmora","gold_medals":6,"silver_medals":0,"bronze_medals":0},
{"country":"Estoria","gold_medals":5,"silver_medals":5,"bronze_medals":0},
{"country":"Aland","gold_medals":5,"silver_medals":4,"bronze_medals":3},
{"country":"Borealis","gold_medals":5,"silver_medals":4,"bronze_medals":3},
{"country":"Cyrenia","gold_medals":5,"silver_medals":4,"bronze_medals":2}
]The ranking cascade applies left to right: gold, then silver, then bronze, then country.
MedalStandings:
| country | gold_medals | silver_medals | bronze_medals |
|------------|-------------|---------------|---------------|
| Country 10 | 0 | 0 | 0 |
| Country 2 | 0 | 0 | 0 |
| Country 1 | 0 | 0 | 0 |[
{"country":"Country 1","gold_medals":0,"silver_medals":0,"bronze_medals":0},
{"country":"Country 10","gold_medals":0,"silver_medals":0,"bronze_medals":0},
{"country":"Country 2","gold_medals":0,"silver_medals":0,"bronze_medals":0}
]With full medal ties, lexicographic string order decides the final ranking.
Constraints