Problem
Given a Weather
table, write a SQL query to find all dates’ Ids with higher temperature compared to its previous (yesterday’s) dates.
1 |
|
For example, return the following Ids for the above Weather
table:
1 |
|
Explanation
- We can use
INNER JOIN
two tables. The relationship between these two table are the first table has higher temperature than the second table’s temperature, and we can useDATEDIFF
to get the difference between these two table’s date, and the difference must be 1.
Solution
1 |
|