题目标签:

  题目给了我们一个 温度表格,让我们找到 所有温度比之前一天高的,返回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. 【LeetCode 16】最接近的三数之和

    题目链接 [题解] 上一道题那个算法求三个数的和为0的时候,其实就是一个不断在逼近本题中x=0的情况. 那么就套用上面那道题的做法. 在逼近的时候,取个差值的最小值就好了. [代码] class So ...

  2. js面向对象编程(第2版)——js继承多种方式

    附带书籍地址: js面向对象编程(第2版)

  3. vue 复习篇. 注册全局组件,和 组件库

    初篇 ============================================================== 1. 编写loading组件(components/Loading/ ...

  4. Transactional事务管理操作

    Transactional的属性: alue String 可选的限定描述符,指定使用的事务管理器 propagation enum: Propagation 可选的事务传播行为设置 isolatio ...

  5. 牛客Another Distinct Values

    题目 我一开始试了一下n=3,发现不行,于是就猜测只有2可以,交了一发,通过了50%.所以我猜测只有偶数可以,奇数都不行. 中间空白部分放n=2的情况就行.因为n=2的情况时,最大只有2,所以我们可以 ...

  6. STM32嵌入式开发学习笔记(二):将功能封装为库文件

    将所有的函数都堆在main.c文件里不是好的选择,庞大的代码文件会是你维护的障碍,明智的做法是,一种功能封装到一个库文件里. 库文件就是你代码开始部分写的#include<xxxx.h>里 ...

  7. JAVA学习之Java语音基础组成

    Java语音基础组成一.关键字:被Java赋予含义的单词(如class.interface) 二.标识符:在程序中自定义的一些名称三.注释:单行注释(//).多行注释(/**/).文档注释(被java ...

  8. 【AI图像识别一】人脸识别测试探索

    ****************************************************************************** 本文主要介绍AI能力平台的人脸识别技术的测 ...

  9. 前端(二十三)—— Vue环境搭建

    目录 一.Vue环境搭建 一.Vue环境搭建 1.安装node 去官网下载node安装包 傻瓜式安装 万一安装后终端没有node环境,要进行node环境变量的配置(C:\Program Files\n ...

  10. Java控制台

    Console类的目的是使Java程序和控制台之间的交互更容易.Console类是java.io包中的一个实用程序类,用于访问系统控制台.控制台不能保证在所有机器上的Java程序中可访问. 例如,如果 ...