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 ...
随机推荐
- JPA中遇到一些异常的分析与解决
Spring Data JPA踩坑到填坑:1 JPA多对多关 //作者表 //书籍表 Book和Author是多对多关系 先放两张图做个说明:Jpa底层依赖于hibernate,hibernate默认 ...
- thinkphp SAE
SAE介绍 Sina App Engine(简称SAE)是新浪研发中心开发的国内首个公有云计算平台,是新浪云计算战略的核心组成部分,作为一个简单高效的分布式Web服务开发.运行平台越来越受开发者青睐. ...
- 安装beanstalkd - centos
安装: wget https://github.com/kr/beanstalkd/archive/v1.9.tar.gz beanstalkd_v1. beanstalkd_v1..tar.gz . ...
- idea 中使用dataBase插件
最近一段时间重新开始学习Java 使用IntelliJ 发现有个链接数据库插件挺好用的,并且反应速度还挺快的记录下. 点击步骤:View → Tool Windows → data 进行数据库链接 发 ...
- JWT(JSON Web Token) 多网站的单点登录,放弃session 转载https://www.cnblogs.com/lexiaofei/p/7409846.html
多个网站之间的登录信息共享, 一种解决方案是基于cookie - session的登录认证方式,这种方式跨域比较复杂. 另一种替代方案是采用基于算法的认证方式, JWT(json web token) ...
- 剑指offer——42最小的K个数
题目描述 输入n个整数,找出其中最小的K个数.例如输入4,5,1,6,2,7,3,8这8个数字,则最小的4个数字是1,2,3,4,. 题解: 原以为书中会有好方法,想不到还是排序和STL这两种方法 ...
- MySQL数据库(六) —— SQL注入攻击、视图、事物、存储过程、流程控制
SQL注入攻击.视图.事物.存储过程.流程控制 一.SQL注入攻击 1.什么是SQL注入攻击 import pymysql conn = pymysql.Connect( user="roo ...
- Module not found: Error: Can't resolve "xxx" in "xxx"
报错信息 ERROR in multi ./src/index.js ./dist/bundle.js Module not found: Error: Can't resolve './dist/b ...
- 【三】Jmeter接口自动化测试系列之Http接口自动化实战
作者:大虫 本文介绍 Jmeter 工具的 http 接口 自动化测试 实战! 为了通用性,就拿知乎 网站作为实战例子吧! 必备技能:http接口基础知识.抓包,本文不做详细介绍,不会的可以先百度恶补 ...
- Struts2入门示例(Myeclipse)
1.新建Web项目在lib导入struts-2.3.37核心基础jar包 2.在WebRoot新建2个JSP demo1.jsp <%@ page language="java&quo ...