环保网站策划书,tk域名注册网站,网站开发教材,做网站服务器还是虚拟空间好文章目录1. 题目2. 解题1. 题目
给定一个 Weather 表#xff0c;编写一个 SQL 查询#xff0c;来查找与之前#xff08;昨天的#xff09;日期相比温度更高的所有日期的 Id。
---------------------------------------------
| Id(INT) | RecordDate(DATE) | Temperature…
文章目录1. 题目2. 解题1. 题目
给定一个 Weather 表编写一个 SQL 查询来查找与之前昨天的日期相比温度更高的所有日期的 Id。
---------------------------------------------
| Id(INT) | RecordDate(DATE) | Temperature(INT) |
---------------------------------------------
| 1 | 2015-01-01 | 10 |
| 2 | 2015-01-02 | 25 |
| 3 | 2015-01-03 | 20 |
| 4 | 2015-01-04 | 30 |
---------------------------------------------
例如根据上述给定的 Weather 表格返回如下 Id:----
| Id |
----
| 2 |
| 4 |
----来源力扣LeetCode 链接https://leetcode-cn.com/problems/rising-temperature 著作权归领扣网络所有。商业转载请联系官方授权非商业转载请注明出处。 2. 解题
# Write your MySQL query statement below
select w1.Id
from Weather w1, Weather w2
where date_sub(w1.RecordDate, interval 1 day) w2.RecordDateand w1.Temperature w2.Temperatureor
# Write your MySQL query statement below
select w1.Id
from Weather w1, Weather w2
where datediff(w1.RecordDate, w2.RecordDate) 1and w1.Temperature w2.Temperatureor
# Write your MySQL query statement below
select w1.Id
from Weather w1, Weather w2
where date_add(w2.RecordDate, interval 1 day) w1.RecordDateand w1.Temperature w2.Temperature我的CSDN博客地址 https://michael.blog.csdn.net/
长按或扫码关注我的公众号Michael阿明一起加油、一起学习进步