1294. Weather Type in Each Country

https://leetcode.com/problems/weather-type-in-each-country

Description

Table: Countries


+---------------+---------+
| Column Name   | Type    |
+---------------+---------+
| country\_id    | int     |
| country\_name  | varchar |
+---------------+---------+
country\_id is the primary key for this table.
Each row of this table contains the ID and the name of one country.

Table: Weather


+---------------+---------+
| Column Name   | Type    |
+---------------+---------+
| country\_id    | int     |
| weather\_state | varchar |
| day           | date    |
+---------------+---------+
(country\_id, day) is the primary key for this table.
Each row of this table indicates the weather state in a country for one day.

Write an SQL query to find the type of weather in each country for November 2019.

The type of weather is Cold if the average weather_state is less than or equal 15, Hot if the average weather_state is greater than or equal 25 and Warm otherwise.

Return result table in any order.

The query result format is in the following example:

ac

Last updated

Was this helpful?