题目标签:

  题目给了我们一个 温度表格,让我们找到 所有温度比之前一天高的,返回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. leyou_04_使用vue.js搭建页面—使用ajax完成品牌的查询

    1.使用vue.js搭建页面 1.1使用的模板插件Vuetify 中文UI组件官网:https://vuetifyjs.com/zh-Hans/getting-started/quick-start ...

  2. tomcat8.5在centos部署阿里云免费证书

    最近在做微信小程序,部署完服务器之后,发现报了个错误,说是我的域名不在以下合法域名列表中.对比了一下才发现我的域名还是http的没升级到https,之后我就到阿里云去申请了证书.中间有一次审核失败,查 ...

  3. CF D. Walking Between Houses (贪心)

    题意: 现在有n个房子排成一列,编号为1~n,起初你在第1个房子里,现在你要进行k次移动,每次移动一都可以从一个房子i移动到另外一个其他的房子j里(i != j),移动的距离为|j - i|.问你进过 ...

  4. 6-23 EDM的报告

    EDM营销(Email Direct Marketing)也即:Email营销. 目的:数据分析.制定一对一的个性化数据.提高用户访问率.EDM是一对一的沟通,让你的用户感觉到尊重, 方式:选择强有力 ...

  5. 第二记 Java数据类型

    一.数据类型 java中数据类型分为基本数据与引用数据类型两大类,其中又有更细致的划分,下面以图展示 二.基本数据类型封装类 Java是一门面向对象的语言,但是在一些情况下基本数据类型无法满足Java ...

  6. MS Sql添加描述信息 及其他信息

    --查询某个表的描述 SELECT * FROM fn_listextendedproperty (NULL, 'user', 'dbo', 'table', '(表名)',NULL, NULL) - ...

  7. git提交遇到.suo文件无法提交的问题

    这个只是我个人遇到的一个问题小记 由于最近做的项目使用VS编辑器的,在用它集成创建的项目里,每次提交都会有个后缀名为.suo的文件在修改的文件列表里.这时直接进行提交会报错, 1.我将xx.suo/x ...

  8. SpringBoot Controller 中使用多个@RequestBody的正确姿势

    最近遇到Controller中需要多个@RequestBody的情况,但是发现并不支持这种写法, 这样导致 1.单个字符串等包装类型都要写一个对象才可以用@RequestBody接收: 2.多个对象需 ...

  9. Linux下NODE配置NODE_PATH变量

    在当我们使用了npm install express -g安装之后的,会安装在全局目录下,但是如果直接用Node来启动程序的话,是无法发现这个包的,原因就在于NODE_PATH这个环境变量设置的不正确 ...

  10. HTML 自定义元素教程

    组件是 Web 开发的方向,现在的热点是 JavaScript 组件,但是 HTML 组件未来可能更有希望. 本文就介绍 HTML 组件的基础知识:自定义元素(custom elements). 文章 ...