Skip to content

Commit 4b52e58

Browse files
authored
feat: update sql solution to lc problem: No.1294 (doocs#1811)
1 parent 2d73cb2 commit 4b52e58

File tree

3 files changed

+15
-16
lines changed

3 files changed

+15
-16
lines changed

solution/1200-1299/1294.Weather Type in Each Country/README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -122,15 +122,15 @@ Morocco 11 月的平均 weather_state 为 (25 + 27 + 31) / 3 = 27.667 所以天
122122
SELECT
123123
country_name,
124124
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'
127127
ELSE 'Warm'
128128
END AS weather_type
129129
FROM
130130
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;
134134
```
135135

136136
<!-- tabs:end -->

solution/1200-1299/1294.Weather Type in Each Country/README_EN.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,15 @@ We know nothing about the average weather_state in Spain in November so we do no
117117
SELECT
118118
country_name,
119119
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'
122122
ELSE 'Warm'
123123
END AS weather_type
124124
FROM
125125
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;
129129
```
130130

131131
<!-- tabs:end -->
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
# Write your MySQL query statement below
21
SELECT
32
country_name,
43
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'
76
ELSE 'Warm'
87
END AS weather_type
98
FROM
109
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;

0 commit comments

Comments
 (0)