197. Rising temperatureQuestion Editorial Solution submissions total accepted:18016 total submissions:68688 difficulty:easy
Given a Weather table, write a SQL query to find all dates ' Ids with higher temperature compared to its previous (Yesterda Y ' s) dates.
+---------+------------+------------------+
| Id (INT) | Date (date) | Temperature (INT) |
+---------+------------+------------------+
| 1 | 2015-01-01 | Ten |
| 2 | 2015-01-02 | |
| 3 | 2015-01-03 | |
| 4 | 2015-01-04 | |
+---------+------------+------------------+
For example, return the following Ids for the above Weather table:
+----+
| Id |
+----+
| 2 |
| 4 |
+----+
Subscribe to the which companies asked this question
Have you met this question in a real interview? Yes
# Write your MySQL query statement below
Select W1. Id from Weather W1, Weather W2 where W1. Temperature>w2. Temperature and To_days (W1. Date)-to_days (W2. Date) = 1;