Problem
Table: Countries
|
|
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
|
|
(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 to 25, and Warm otherwise. Return result table in any order.
Solution
Method 1 - Join
Code
|
|