#力扣MySQL:197. 上升的温度 @FDDLC
发布日期:2021-06-30 21:05:51 浏览次数:2 分类:技术文章

本文共 670 字,大约阅读时间需要 2 分钟。

题目描述:

 

自测用例:

{"headers": {"Weather": ["Id", "RecordDate", "Temperature"]}, "rows": {"Weather": [[1, "2015-01-01", 10], [2, "2015-01-02", 25], [3, "2015-01-03", 20], [4, "2015-01-04", 30]]}}

{"headers": {"Weather": ["Id", "RecordDate", "Temperature"]}, "rows": {"Weather": [[1, "2015-01-01", 10], [2, "2015-01-02", 25], [4, "2015-01-03", 20],[5, "2000-02-29", 20],[6, "2000-03-01", 23], [3, "2015-01-04", 30]]}}

 

错误解法:

select cur.id Id from Weather cur,Weather prewhere cur.recordDate=pre.recordDate+1 and cur.Temperature>pre.Temperature;

 

SQL:

select cur.id Id from Weather cur,Weather prewhere datediff(cur.recordDate,pre.recordDate)=1 and cur.Temperature>pre.Temperature;

 

 

 

 

 

 

 

 

 

 

转载地址:https://liuxingchang.blog.csdn.net/article/details/117049146 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:#力扣MySQL:596. 超过5名学生的课 @FDDLC
下一篇:#力扣 LeetCode1827. 最少操作使数组递增 @FDDLC

发表评论

最新留言

路过按个爪印,很不错,赞一个!
[***.219.124.196]2024年04月13日 20时05分35秒