197. Rising Temperature
来源:互联网 发布:儿童编程 ipad 编辑:程序博客网 时间:2024/06/06 11:40
Given a Weather
table, write a SQL query to find all dates' Ids with higher temperature compared to its previous (yesterday's) dates.
+---------+------------+------------------+| Id(INT) | Date(DATE) | Temperature(INT) |+---------+------------+------------------+| 1 | 2015-01-01 | 10 || 2 | 2015-01-02 | 25 || 3 | 2015-01-03 | 20 || 4 | 2015-01-04 | 30 |+---------+------------+------------------+For example, return the following Ids for the above Weather table:
+----+| Id |+----+| 2 || 4 |+----+
解答:
# Write your MySQL query statement below
select w1.Id from Weather w1,Weather w2 where DATEDIFF(w1.date, w2.date) = 1 and w1.Temperature>w2.Temperature
重点是DateDiff函数
阅读全文
0 0
- 197. Rising Temperature
- 197. Rising Temperature
- LeetCode 197. Rising Temperature
- leetcode.197. Rising Temperature
- leetcode 197. Rising Temperature
- leetcode 197. Rising Temperature
- 197. Rising Temperature
- Leetcode 197. Rising Temperature
- 197. Rising Temperature#1
- 197. Rising Temperature
- 197. Rising Temperature--DATEDIFF()
- 197. Rising Temperature
- 197. Rising Temperature
- 197. Rising Temperature
- leetcode 197. Rising Temperature to_days()
- 【leetcode Database】197. Rising Temperature
- 197. Rising Temperature(Lettcode)
- Rising Temperature
- 第一次玩CsdnBOKE
- 198. House Robber
- 如何快速生成十九大会议内容摘要
- 多项式相加减【数据结构实验报告】
- webview高度自适应图文详情
- 197. Rising Temperature
- i386和X86各是什么意思
- 归并算法的JS实现及分析(分治,递归,归并)
- 模拟
- Java动态代理
- 奇点到来,超越人类 《Nature论文:人工智能从0-1自学打败阿法狗 》论文翻译
- 流式套接字实现简单的客户端/服务端通信过程
- 胡小胖:哪六大人群适合做微商呢?全面剖析微商职业类型!
- webView自适应实际内容高度的问题