49.上升的温度

表: Weather

+---------------+---------+
| Column Name   | Type    |
+---------------+---------+
| id            | int     |
| recordDate    | date    |
| temperature   | int     |
+---------------+---------+
id 是这个表的主键
该表包含特定日期的温度信息
 

编写一个 SQL 查询,来查找与之前(昨天的)日期相比温度更高的所有日期的 id 。

返回结果 不要求顺序 。

查询结果格式如下例。

 

# Write your MySQL query statement below
select w2.id
from Weather w1 join Weather w2
#w1为昨天表 求得今天的温度比昨天高的id
#不能返回当月天数 还是得求总天数 to_days(data) 从0000年到现在的天数
on to_days(w1.recordDate)+1=to_days(w2.recordDate)
where w1.Temperature<w2.Temperature;

 

posted @ 2022-03-15 08:07  随遇而安==  阅读(23)  评论(0编辑  收藏  举报