File tree 3 files changed +15
-16
lines changed
solution/1200-1299/1294.Weather Type in Each Country
3 files changed +15
-16
lines changed Original file line number Diff line number Diff line change @@ -122,15 +122,15 @@ Morocco 11 月的平均 weather_state 为 (25 + 27 + 31) / 3 = 27.667 所以天
122
122
SELECT
123
123
country_name,
124
124
CASE
125
- WHEN avg (weather_state) <= 15 THEN ' Cold'
126
- WHEN avg (weather_state) >= 25 THEN ' Hot'
125
+ WHEN AVG (weather_state) <= 15 THEN ' Cold'
126
+ WHEN AVG (weather_state) >= 25 THEN ' Hot'
127
127
ELSE ' Warm'
128
128
END AS weather_type
129
129
FROM
130
130
Weather AS w
131
- JOIN Countries AS c ON w . country_id = c . country_id
132
- WHERE date_format (day, ' %Y-%m' ) = ' 2019-11'
133
- GROUP BY w . country_id ;
131
+ JOIN Countries USING ( country_id)
132
+ WHERE DATE_FORMAT (day, ' %Y-%m' ) = ' 2019-11'
133
+ GROUP BY 1 ;
134
134
```
135
135
136
136
<!-- tabs:end -->
Original file line number Diff line number Diff line change @@ -117,15 +117,15 @@ We know nothing about the average weather_state in Spain in November so we do no
117
117
SELECT
118
118
country_name,
119
119
CASE
120
- WHEN avg (weather_state) <= 15 THEN ' Cold'
121
- WHEN avg (weather_state) >= 25 THEN ' Hot'
120
+ WHEN AVG (weather_state) <= 15 THEN ' Cold'
121
+ WHEN AVG (weather_state) >= 25 THEN ' Hot'
122
122
ELSE ' Warm'
123
123
END AS weather_type
124
124
FROM
125
125
Weather AS w
126
- JOIN Countries AS c ON w . country_id = c . country_id
127
- WHERE date_format (day, ' %Y-%m' ) = ' 2019-11'
128
- GROUP BY w . country_id ;
126
+ JOIN Countries USING ( country_id)
127
+ WHERE DATE_FORMAT (day, ' %Y-%m' ) = ' 2019-11'
128
+ GROUP BY 1 ;
129
129
```
130
130
131
131
<!-- tabs:end -->
Original file line number Diff line number Diff line change 1
- # Write your MySQL query statement below
2
1
SELECT
3
2
country_name,
4
3
CASE
5
- WHEN avg (weather_state) <= 15 THEN ' Cold'
6
- WHEN avg (weather_state) >= 25 THEN ' Hot'
4
+ WHEN AVG (weather_state) <= 15 THEN ' Cold'
5
+ WHEN AVG (weather_state) >= 25 THEN ' Hot'
7
6
ELSE ' Warm'
8
7
END AS weather_type
9
8
FROM
10
9
Weather AS w
11
- JOIN Countries AS c ON w . country_id = c . country_id
12
- WHERE date_format (day, ' %Y-%m' ) = ' 2019-11'
13
- GROUP BY w . country_id ;
10
+ JOIN Countries USING ( country_id)
11
+ WHERE DATE_FORMAT (day, ' %Y-%m' ) = ' 2019-11'
12
+ GROUP BY 1 ;
You can’t perform that action at this time.
0 commit comments