Skip to content

Commit 3efa26a

Browse files
committed
feat: add sql solution to lc problem: No.1294
No.1294.Weather Type in Each Country
1 parent d87d193 commit 3efa26a

File tree

3 files changed

+45
-2
lines changed

3 files changed

+45
-2
lines changed

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

+15-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,21 @@ Morocco 11 月的平均 weather_state 为 (25 + 27 + 31) / 3 = 27.667 所以天
106106
### **SQL**
107107

108108
```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
110124
```
111125

112126
<!-- tabs:end -->

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

+15-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,21 @@ We know nothing about the average weather_state in Spain in November so we do no
113113
### **SQL**
114114

115115
```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
117131
```
118132

119133
<!-- tabs:end -->
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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

0 commit comments

Comments
 (0)