#力扣MySQL:197. 上升的温度 @FDDLC
发布日期:2021-06-30 21:05:51
浏览次数:3
分类:技术文章
本文共 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 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
逛到本站,mark一下
[***.202.152.39]2024年04月24日 17时33分52秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
HDU - 1166 敌兵布阵 (树状数组模板题/线段树模板题)
2019-04-30
CodeForces - 761C Dasha and Password (思维 暴力)
2019-04-30
POJ - 2481 Cows (树状数组 入门题)
2019-04-30
ACM-ICPC 2018 焦作赛区网络预赛 I. Save the Room
2019-04-30
CodeForces - 987C Three displays (暴力/dp)
2019-04-30
计蒜客 NAIPC 2016 F. Mountain Scenes(dp)
2019-04-30
牛客国庆集训派对Day4——I 连通块计数(思维)
2019-04-30
牛客国庆集训派对Day4——G 区间权值(找规律,双重前缀和)
2019-04-30
牛客国庆集训派对Day5——L 数论之神(找规律/数论)
2019-04-30
CodeForces - 629B Far Relative’s Problem(模拟)
2019-04-30
CodeForces - 1059B Forgery (思维)
2019-04-30
CodeForces - 456C Boredom (dp)
2019-04-30
CodeForces - 960B Minimize the error (思维,贪心)
2019-04-30
CodeForces - 97B Superset (思维/分治/构造)
2019-04-30
CodeForces - 675A Infinite Sequence(简单数论 细节)
2019-04-30