题目标签:

  题目给了我们一个 温度表格,让我们找到 所有温度比之前一天高的,返回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. Read Committed

    在Read Committed隔离级别下,一个事务可能会遇到不可重复读(Non Repeatable Read)的问题. 不可重复读是指,在一个事务内,多次读同一数据,在这个事务还没有结束时,如果另一 ...

  2. C++ STL(一)介绍及string

    STL: C++标准模板库的简称,它是C++的一部份.标准C++库的所有的标识符都是在一个名为std的命名空间中定义的 在使用STL中相关模板时,需要包含相关头文件,然后using namespace ...

  3. Tomcat启动报:The Server time zone value 'XXXXX' 乱码问题解决

    今天给自己项目打包到服务器发布时,运行时,发现报 java.sql.SQLException: The server time zone value '�й���׼ʱ��' is unrecogniz ...

  4. eclipse中svn的各种图标详解

    参考:http://blog.sina.com.cn/s/blog_637810b101018xw0.html - 已忽略版本控制的文件.可以通过Window → Preferences → Team ...

  5. (转)浅谈C中的malloc和free

    原帖及讨论:http://bbs.bccn.net/thread-82212-1-1.html 在C语言的学习中,对内存管理这部分的知识掌握尤其重要!之前对C中的malloc()和free()两个函数 ...

  6. P1493 分梨子

    P1493 分梨子 题目描述 Finley家的院子里有棵梨树,最近收获了许多梨子.于是,Finley决定挑出一些梨子,分给幼稚园的宝宝们.可是梨子大小味道都不太一样,一定要尽量挑选那些差不多的梨子分给 ...

  7. project的操作说明

    project 1 操作的步骤 设定一个起始时间:7月1号 安排好摘要(任务)的先后顺序 一个一个任务的来:A任务,下面有几个分布实现的部门: 设计部门 3个工作日 程序部门 1个工作日.然后配置相互 ...

  8. 1、获取APP 冷/热启动时间

    最近在研究Android APP性能测试.所以发现一些有趣的东西,在这里进行分享.我们先讲第一个内容,如何获取APP冷/热启动时间?为什么要做这个测试,道理其实很简单,如果启动APP特别耗时的话,用户 ...

  9. 22. Jmeter NON GUI模式

    一般情况下我们都是在NonGUI模式下运行jmeter.这样做有两个好处 节省系统资源,能够产生更大的负载 可以通过命令行参数对测试场景进行更精细的配置 需求:模拟5个用户同时访问百度首页的情况 步骤 ...

  10. nth_element函数

    使用方法:nth_element(start, start+n, end) 使第n大元素处于第n位置(从0开始,其位置是下标为n的元素),并且比这个元素小的元素都排在这个元素之前,比这个元素大的元素都 ...