197. Rising Temperature
来源:互联网 发布:window.open php 编辑:程序博客网 时间:2024/05/17 03:09
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
# Write your MySQL query statement belowselect a.Id from Weather a inner join Weather b on b.Date+interval 1 day =a.Date where a.Temperature>b.Temperature;
# write your MySQL query statement belowselect a.Id from Weather a inner join Weather b on datediff(a.Date, b.Date) = 1 where a.Temperature>b.Temperature;
# Write your MySQL query statement belowSELECT wt1.Id FROM Weather wt1,Weather wt2 WHERE TO_DAYS(wt1.DATE)-TO_DAYS(wt2.DATE)=1 && wt1.Temperature>wt2.Temperature;
# Write your MySQL query statement belowSELECT wt1.Id FROM Weather wt1,Weather wt2 WHERE SUBDATE(wt1.DATE,1)=wt2.DATE && wt1.Temperature>wt2.Temperature;
# Write your MySQL query statement belowSELECT wt1.Id FROM Weather wt1,Weather wt2 WHERE DATEDIFF(wt1.DATE,wt2.DATE)=1 && wt1.Temperature>wt2.Temperature;
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
- Serializable接口
- LeetCode Reorder List
- LINE分享android利用系统自带分享实现LINE分享功能
- java中int和Integer的区别
- 异常处理编程
- 197. Rising Temperature
- [Android] 去掉标题栏的方法
- 二叉搜索树
- win7安装VMware Player+os x 10.10 +xcode7.2
- js 实现快捷键-event:altKey ctrlKey shiftKey
- 社会艰难,该何往?
- BeanUtil
- 自定义View
- c++实验7-最大公约数与最小公倍数