题目标签:

  题目给了我们一个 温度表格,让我们找到 所有温度比之前一天高的,返回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. SQL复制数据表及表结构

    select * into 目标表名 from 源表名 insert into 目标表名(fld1, fld2) select fld1, 5 from 源表名 以上两句都是将'源表'的数据插入到'目 ...

  2. jmeter测试之-脚本制作

    一.脚本录制  1.遇见的问题,回放的时候总是登录失败 解决方式:设置HTTP请求为—跟随重定向 2.新增一个用户的时候,脚本参数里面输入汉字,在浏览器查看的时候显示问号 解决方式:脚本编码方式增加u ...

  3. 18、webservice使用

    1.将axis2.war文件拷到tomcat,webapp文件夹下,然后重启tomcat 访问

  4. npm cnpm node yarn

    1.yarn: windows 下需要下载msi文件, 2.npm,node 安装绿色版本 3.cnpm安装:npm install -g cnpm --registry=https://regist ...

  5. 3. Python基础语法

    注释 我们在文言文中经常会看到注释,注释可以帮助读者对文章的理解.代码中的注释也是一样,优秀的代码注释可以帮助读者对代码的理解.当然在代码编写过程中,注释的使用不一定只是描述一段代码,也可能的是对代码 ...

  6. 第四记 Java异常

    Java异常结构图 Java所有异常都是从Throwable继承而来,Throwable有两个子类,Error与Exception. Error是错误,对于所有的编译时期的错误以及系统错误都是通过Er ...

  7. 从可变长函数到legb

    可变长参数 * *形参 用元组接收接收多余的位置实参 约定俗成形参名为 *args def f1(*args):#调用函数时,有多少个参数我就接收多少个 res = 0 for num in args ...

  8. touchWX使用 echarts

    <button bindtap="init" wx:if="{{!isLoaded}}">加载图表</button> <butto ...

  9. python--面向对象:多态与封装

    一.多态 :python 天生支持多态多态指的是一类事物有多种形态 eg:文件有多种形态:文本文件,可执行文件鸭子类型:python中崇尚鸭子类型,不崇尚根据继承所得来的相似 优点 : 松耦合 每个相 ...

  10. 2019-9-25-如何让-USB-设备不显示安全删除硬件弹出选项

    title author date CreateTime categories 如何让 USB 设备不显示安全删除硬件弹出选项 lindexi 2019-09-25 11:58:19 +0800 20 ...