Loading content...
A beverage intelligence platform tracks tasting points from winery events around the world.
You are given one table:
Wineries columns:
A winery can appear in multiple rows within the same country. Its final score for that country is the sum of all points across its rows.
Task: For each country, produce a three-position podium of wineries:
Missing position rules:
Output columns (exact order):
Sort final output by country in ascending order.
Supported submission environments:
Wineries:
| id | country | points | winery |
|-----|-----------|--------|-----------------|
| 103 | Australia | 84 | WhisperingPines |
| 737 | Australia | 85 | GrapesGalore |
| 848 | Australia | 100 | HarmonyHill |
| 222 | Hungary | 60 | MoonlitCellars |
| 116 | USA | 47 | RoyalVines |
| 124 | USA | 45 | EaglesNest |
| 648 | India | 69 | SunsetVines |
| 894 | USA | 39 | RoyalVines |
| 677 | USA | 9 | PacificCrest |[
{"country":"Australia","top_winery":"HarmonyHill (100)","second_winery":"GrapesGalore (85)","third_winery":"WhisperingPines (84)"},
{"country":"Hungary","top_winery":"MoonlitCellars (60)","second_winery":"No second winery","third_winery":"No third winery"},
{"country":"India","top_winery":"SunsetVines (69)","second_winery":"No second winery","third_winery":"No third winery"},
{"country":"USA","top_winery":"RoyalVines (86)","second_winery":"EaglesNest (45)","third_winery":"PacificCrest (9)"}
]RoyalVines is aggregated to 86 points in USA (47 + 39). In countries with only one winery, second and third slots use default strings.
Wineries:
| id | country | points | winery |
|----|---------|--------|-----------|
| 1 | France | 30 | AmberOak |
| 2 | France | 20 | AmberOak |
| 3 | France | 50 | BlueCellar|
| 4 | France | 40 | CedarPeak |
| 5 | France | 5 | DeltaVale |
| 6 | France | 35 | DeltaVale |
| 7 | Italy | 55 | LunaEstate|
| 8 | Italy | 10 | MareVista |[
{"country":"France","top_winery":"AmberOak (50)","second_winery":"BlueCellar (50)","third_winery":"CedarPeak (40)"},
{"country":"Italy","top_winery":"LunaEstate (55)","second_winery":"MareVista (10)","third_winery":"No third winery"}
]In France, AmberOak and BlueCellar tie at 50, so alphabetical order places AmberOak first.
Wineries:
| id | country | points | winery |
|----|---------|--------|--------------|
| 50 | Chile | 88 | AndesBloom |
| 51 | Peru | 45 | CuscoCellars |
| 52 | Peru | 61 | PiscoHeights |[
{"country":"Chile","top_winery":"AndesBloom (88)","second_winery":"No second winery","third_winery":"No third winery"},
{"country":"Peru","top_winery":"PiscoHeights (61)","second_winery":"CuscoCellars (45)","third_winery":"No third winery"}
]Each country is evaluated independently. Chile has one winery, while Peru has two.
Constraints