Loading problem...
A global analytics team tracks daily climate indicators and needs a monthly country-level classification report.
Table: countries
Table: weather
Task: For each country, compute the average weather_state for November 2019 and classify the country into one of three weather bands.
Band rules:
Output requirements:
Supported submission environments:
countries:
| country_id | country_name |
|------------|--------------|
| 2 | USA |
| 3 | Australia |
| 7 | Peru |
| 5 | China |
| 8 | Morocco |
| 9 | Spain |
weather:
| country_id | weather_state | day |
|------------|---------------|------------|
| 2 | 15 | 2019-11-01 |
| 2 | 12 | 2019-10-28 |
| 3 | -2 | 2019-11-10 |
| 3 | 0 | 2019-11-11 |
| 3 | 3 | 2019-11-12 |
| 5 | 16 | 2019-11-07 |
| 5 | 18 | 2019-11-09 |
| 5 | 21 | 2019-11-23 |
| 7 | 25 | 2019-11-28 |
| 8 | 25 | 2019-11-05 |
| 8 | 27 | 2019-11-15 |
| 8 | 31 | 2019-11-25 |
| 9 | 7 | 2019-10-23 |
| 9 | 3 | 2019-12-23 |[
{"country_name":"Australia","weather_type":"Cold"},
{"country_name":"China","weather_type":"Warm"},
{"country_name":"Morocco","weather_type":"Hot"},
{"country_name":"Peru","weather_type":"Hot"},
{"country_name":"USA","weather_type":"Cold"}
]Only November rows are considered. Spain has no November rows, so it is excluded.
countries:
| country_id | country_name |
|------------|--------------|
| 1 | Northland |
| 2 | Suncape |
| 3 | Mildoria |
weather:
| country_id | weather_state | day |
|------------|---------------|------------|
| 1 | 10 | 2019-11-01 |
| 1 | 20 | 2019-11-02 |
| 2 | 24 | 2019-11-01 |
| 2 | 26 | 2019-11-02 |
| 3 | 18 | 2019-11-01 |
| 3 | 20 | 2019-11-02 |[
{"country_name":"Mildoria","weather_type":"Warm"},
{"country_name":"Northland","weather_type":"Cold"},
{"country_name":"Suncape","weather_type":"Hot"}
]Northland averages 15 (Cold), Suncape averages 25 (Hot), and Mildoria averages 19 (Warm).
countries:
| country_id | country_name |
|------------|--------------|
| 10 | Borealis |
| 20 | Equatoris |
weather:
| country_id | weather_state | day |
|------------|---------------|------------|
| 10 | 7 | 2019-10-20 |
| 10 | 8 | 2019-12-05 |
| 20 | 30 | 2019-12-09 |[]No country has weather rows in November 2019.
Constraints