2022-03-27 20:56:26 +08:00
|
|
|
|
<div class="original__bRMd">
|
|
|
|
|
<div>
|
|
|
|
|
<p>表: <code>Weather</code></p>
|
|
|
|
|
|
|
|
|
|
<pre>
|
|
|
|
|
+---------------+---------+
|
|
|
|
|
| Column Name | Type |
|
|
|
|
|
+---------------+---------+
|
|
|
|
|
| id | int |
|
|
|
|
|
| recordDate | date |
|
|
|
|
|
| temperature | int |
|
|
|
|
|
+---------------+---------+
|
2023-12-09 18:42:21 +08:00
|
|
|
|
id 是该表具有唯一值的列。
|
2022-03-27 20:56:26 +08:00
|
|
|
|
该表包含特定日期的温度信息</pre>
|
|
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
|
2023-12-09 18:42:21 +08:00
|
|
|
|
<p>编写解决方案,找出与之前(昨天的)日期相比温度更高的所有日期的 <code>id</code> 。</p>
|
2022-03-27 20:56:26 +08:00
|
|
|
|
|
2023-12-09 18:42:21 +08:00
|
|
|
|
<p>返回结果 <strong>无顺序要求</strong> 。</p>
|
2022-03-27 20:56:26 +08:00
|
|
|
|
|
2023-12-09 18:42:21 +08:00
|
|
|
|
<p>结果格式如下例子所示。</p>
|
2022-03-27 20:56:26 +08:00
|
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
|
2023-12-09 18:42:21 +08:00
|
|
|
|
<p><strong class="example">示例 1:</strong></p>
|
2022-03-27 20:56:26 +08:00
|
|
|
|
|
|
|
|
|
<pre>
|
|
|
|
|
<code><strong>输入:</strong>
|
|
|
|
|
Weather 表:</code>
|
|
|
|
|
+----+------------+-------------+
|
|
|
|
|
| id | recordDate | Temperature |
|
|
|
|
|
+----+------------+-------------+
|
|
|
|
|
| 1 | 2015-01-01 | 10 |
|
|
|
|
|
| 2 | 2015-01-02 | 25 |
|
|
|
|
|
| 3 | 2015-01-03 | 20 |
|
|
|
|
|
| 4 | 2015-01-04 | 30 |
|
|
|
|
|
+----+------------+-------------+
|
|
|
|
|
<strong>输出:</strong>
|
|
|
|
|
+----+
|
|
|
|
|
| id |
|
|
|
|
|
+----+
|
|
|
|
|
| 2 |
|
|
|
|
|
| 4 |
|
|
|
|
|
+----+
|
|
|
|
|
<strong>解释:</strong>
|
|
|
|
|
2015-01-02 的温度比前一天高(10 -> 25)
|
|
|
|
|
2015-01-04 的温度比前一天高(20 -> 30)</pre>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|