LeetCode 197. Rising Temperature (上升的温度)
题目标签:
题目给了我们一个 温度表格,让我们找到 所有温度比之前一天高的,返回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 (上升的温度)的更多相关文章
- leetcode 197. Rising Temperature sql_Date用法
https://leetcode.com/problems/rising-temperature/description/ 题目需要选出今天比昨天气温高的ID 用join,默认是inner join需 ...
- Leetcode 197. Rising Temperature
Given a Weather table, write a SQL query to find all dates' Ids with higher temperature compared to ...
- [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 ...
- [SQL]197. Rising Temperature
Given a Weather table, write a SQL query to find all dates' Ids with higher temperature compared to ...
- 197. Rising Temperature
Given a Weather table, write a SQL query to find all dates' Ids with higher temperature compared to ...
- [SQL]LeetCode197. 上升的温度 | Rising Temperature
SQL架构 Create table If Not Exists Weather (Id int, RecordDate date, Temperature int) Truncate table W ...
- [LeetCode] Rising Temperature 上升温度
Given a Weather table, write a SQL query to find all dates' Ids with higher temperature compared to ...
- DateBase -- Rising Temperature
Question: Given a Weather table, write a SQL query to find all dates' Ids with higher temperature co ...
- LeetCode All in One 题目讲解汇总(持续更新中...)
终于将LeetCode的免费题刷完了,真是漫长的第一遍啊,估计很多题都忘的差不多了,这次开个题目汇总贴,并附上每道题目的解题连接,方便之后查阅吧~ 477 Total Hamming Distance ...
随机推荐
- 【LeetCode 16】最接近的三数之和
题目链接 [题解] 上一道题那个算法求三个数的和为0的时候,其实就是一个不断在逼近本题中x=0的情况. 那么就套用上面那道题的做法. 在逼近的时候,取个差值的最小值就好了. [代码] class So ...
- js面向对象编程(第2版)——js继承多种方式
附带书籍地址: js面向对象编程(第2版)
- vue 复习篇. 注册全局组件,和 组件库
初篇 ============================================================== 1. 编写loading组件(components/Loading/ ...
- Transactional事务管理操作
Transactional的属性: alue String 可选的限定描述符,指定使用的事务管理器 propagation enum: Propagation 可选的事务传播行为设置 isolatio ...
- 牛客Another Distinct Values
题目 我一开始试了一下n=3,发现不行,于是就猜测只有2可以,交了一发,通过了50%.所以我猜测只有偶数可以,奇数都不行. 中间空白部分放n=2的情况就行.因为n=2的情况时,最大只有2,所以我们可以 ...
- STM32嵌入式开发学习笔记(二):将功能封装为库文件
将所有的函数都堆在main.c文件里不是好的选择,庞大的代码文件会是你维护的障碍,明智的做法是,一种功能封装到一个库文件里. 库文件就是你代码开始部分写的#include<xxxx.h>里 ...
- JAVA学习之Java语音基础组成
Java语音基础组成一.关键字:被Java赋予含义的单词(如class.interface) 二.标识符:在程序中自定义的一些名称三.注释:单行注释(//).多行注释(/**/).文档注释(被java ...
- 【AI图像识别一】人脸识别测试探索
****************************************************************************** 本文主要介绍AI能力平台的人脸识别技术的测 ...
- 前端(二十三)—— Vue环境搭建
目录 一.Vue环境搭建 一.Vue环境搭建 1.安装node 去官网下载node安装包 傻瓜式安装 万一安装后终端没有node环境,要进行node环境变量的配置(C:\Program Files\n ...
- Java控制台
Console类的目的是使Java程序和控制台之间的交互更容易.Console类是java.io包中的一个实用程序类,用于访问系统控制台.控制台不能保证在所有机器上的Java程序中可访问. 例如,如果 ...