力扣高频SQL 50题(基础版)第九题
197. 上升的温度
题目说明
Weather
±--------------±--------+
| Column Name | Type |
±--------------±--------+
| id | int |
| recordDate | date |
| temperature | int |
±--------------±--------+
id 是该表具有唯一值的列。
没有具有相同 recordDate 的不同行。
该表包含特定日期的温度信息
编写解决方案,找出与之前(昨天的)日期相比温度更高的所有日期的 id
。
返回结果 无顺序要求 。
思路分析
找出与昨天相比温度更高的日期id的思路是使用自连接
的方法。
实现过程
准备数据
Create table If Not Exists Weather (id int, recordDate date, temperature int)
Truncate table Weather
inser