File tree 3 files changed +45
-2
lines changed
solution/1200-1299/1294.Weather Type in Each Country
3 files changed +45
-2
lines changed Original file line number Diff line number Diff line change @@ -106,7 +106,21 @@ Morocco 11 月的平均 weather_state 为 (25 + 27 + 31) / 3 = 27.667 所以天
106
106
### ** SQL**
107
107
108
108
``` sql
109
-
109
+ # Write your MySQL query statement below
110
+ select
111
+ country_name,
112
+ case
113
+ when avg (weather_state) <= 15 then ' Cold'
114
+ when avg (weather_state) >= 25 then ' Hot'
115
+ else ' Warm'
116
+ end weather_type
117
+ from
118
+ Weather w
119
+ join Countries c on w .country_id = c .country_id
120
+ where
121
+ date_format(day, ' %Y-%m' ) = ' 2019-11'
122
+ group by
123
+ w .country_id
110
124
```
111
125
112
126
<!-- tabs:end -->
Original file line number Diff line number Diff line change @@ -113,7 +113,21 @@ We know nothing about the average weather_state in Spain in November so we do no
113
113
### ** SQL**
114
114
115
115
``` sql
116
-
116
+ # Write your MySQL query statement below
117
+ select
118
+ country_name,
119
+ case
120
+ when avg (weather_state) <= 15 then ' Cold'
121
+ when avg (weather_state) >= 25 then ' Hot'
122
+ else ' Warm'
123
+ end weather_type
124
+ from
125
+ Weather w
126
+ join Countries c on w .country_id = c .country_id
127
+ where
128
+ date_format(day, ' %Y-%m' ) = ' 2019-11'
129
+ group by
130
+ w .country_id
117
131
```
118
132
119
133
<!-- tabs:end -->
Original file line number Diff line number Diff line change
1
+ # Write your MySQL query statement below
2
+ select
3
+ country_name,
4
+ case
5
+ when avg (weather_state) <= 15 then ' Cold'
6
+ when avg (weather_state) >= 25 then ' Hot'
7
+ else ' Warm'
8
+ end weather_type
9
+ from
10
+ Weather w
11
+ join Countries c on w .country_id = c .country_id
12
+ where
13
+ date_format(day, ' %Y-%m' ) = ' 2019-11'
14
+ group by
15
+ w .country_id
You can’t perform that action at this time.
0 commit comments