Im between cherry

Leet Code | MySQL | 197. Rising Temperature 본문

데이터분석/practice_query

Leet Code | MySQL | 197. Rising Temperature

meal 2020. 8. 30. 15:35

197. Rising Temperature

 

https://leetcode.com/problems/rising-temperature/

 

Rising Temperature - LeetCode

Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.

leetcode.com

Write an SQL query to find all dates' id with higher temperature compared to its previous dates (yesterday).

Return the result table in any order.

 

 

SELECT today.id
FROM Weather AS today
    INNER JOIN Weather AS yesterday ON DATE_ADD(yesterday.recordDate, INTERVAL 1 DAY) = today.recordDate
WHERE today.temperature > yesterday.temperature

 

Comments