题目标签:

  题目给了我们一个 温度表格,让我们找到 所有温度比之前一天高的,返回id。

  建立 Weather w1, Weather w2,找到当w1 的温度 大于 w2 的时候,而且 w1 的日期是在w2 的后一天,返回id。

Java Solution:

Runtime:  338 ms, faster than 66 %

Memory Usage: N/A

完成日期:06/01/2019

关键点:利用TO_DAYS 来比较日期。

# Write your MySQL query statement below
SELECT w1.Id
FROM Weather w1, Weather w2
WHERE w1.Temperature > w2.Temperature AND
TO_DAYS(w1.RecordDate)-TO_DAYS(w2.RecordDate)=1;

参考资料:LeetCode Solution

LeetCode 题目列表 - LeetCode Questions List

题目来源:https://leetcode.com/

LeetCode 197. Rising Temperature (上升的温度)的更多相关文章

  1. leetcode 197. Rising Temperature sql_Date用法

    https://leetcode.com/problems/rising-temperature/description/ 题目需要选出今天比昨天气温高的ID 用join,默认是inner join需 ...

  2. Leetcode 197. Rising Temperature

    Given a Weather table, write a SQL query to find all dates' Ids with higher temperature compared to ...

  3. [LeetCode] 197. Rising Temperature_Easy tag: SQL

    Given a Weather table, write a SQL query to find all dates' Ids with higher temperature compared to ...

  4. [SQL]197. Rising Temperature

    Given a Weather table, write a SQL query to find all dates' Ids with higher temperature compared to ...

  5. 197. Rising Temperature

    Given a Weather table, write a SQL query to find all dates' Ids with higher temperature compared to ...

  6. [SQL]LeetCode197. 上升的温度 | Rising Temperature

    SQL架构 Create table If Not Exists Weather (Id int, RecordDate date, Temperature int) Truncate table W ...

  7. [LeetCode] Rising Temperature 上升温度

    Given a Weather table, write a SQL query to find all dates' Ids with higher temperature compared to ...

  8. DateBase -- Rising Temperature

    Question: Given a Weather table, write a SQL query to find all dates' Ids with higher temperature co ...

  9. LeetCode All in One 题目讲解汇总(持续更新中...)

    终于将LeetCode的免费题刷完了,真是漫长的第一遍啊,估计很多题都忘的差不多了,这次开个题目汇总贴,并附上每道题目的解题连接,方便之后查阅吧~ 477 Total Hamming Distance ...

随机推荐

  1. java在acm中常用基础技巧方法

    java在acm中常用基础技巧方法 如果学到了新的技巧,本博客会更新~ input input-std @Frosero import java.util.*; public class Main { ...

  2. 暴力字符串hash——cf1200E

    #include<bits/stdc++.h> using namespace std; #define ll long long #define N 1000005 #define mo ...

  3. Linux系统磁盘分区、删除分区、格式化、挂载、卸载、开机自动挂载的方法总结

    Linux系统按照MBR(Master Boot Record)传统分区模式: 注意:传统的MBR(Master Boot Record)分区方式最大只能分2T容量的硬盘,超过2T的硬盘一般采用GPT ...

  4. centos7安装kylo0.10.1

    安装环境centos7,kylo版本0.10.1 常用的链接地址 kylo官网:https://kylo.io/ kylo文档:https://kylo.readthedocs.io/ 下载地址 官网 ...

  5. socket模拟通信

    import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java ...

  6. Echart使用js进行封装成函数

    Echart使用js进行封装成函数 主要是对 json 串的封装,使用 js 进行对 json 的解析.之间用的最多是循环取出数组中的值,如果拿去使用可直接修改 json 就好. 上一篇把二维的封装好 ...

  7. Dubbo入门到精通学习笔记(六):持续集成管理平台之Hudson 持续集成服务器的安装配置与使用

    文章目录 安装Hudson 使用Hudson tips:自动化部署 附录:两个脚本 安装Hudson IP:192.168.4.221 8G 内存(Hudson 多个工程在同时构建的情况下比较耗内存) ...

  8. 剑指offer——69队列的最大值

    题目: 队列的最大值.请定义一个队列并实现函数max得到队列里的最大值,要求函数max.push_back和pop_front的时间复杂度都是O(1). 题解: 使用队列,操持队列的排序为从大到小的顺 ...

  9. 四、vim 编辑器

    vim编辑器 -rw-r--r--. 1 root root 1982 8月 2 2017 /etc/virc vi 配置文件 -rw-r--r--. 1 root root 1982 8月 2 20 ...

  10. eduCF#61 C. Painting the Fence /// DP 选取k段能覆盖的格数

    题目大意: 给定n m 接下来给定m个在n范围内的段的左右端 l r 求选取m-2段 最多能覆盖多少格 #include <bits/stdc++.h> using namespace s ...