Snoopy [리트코드/SQL] 18. Rising Temperature (197)
코딩테스트/리트코드 SQL

[리트코드/SQL] 18. Rising Temperature (197)

Sooyoon Jeong 2022. 12. 18.

목차

 

🤔 문제 분석

1) Write an SQL query to find all dates' Id with higher temperatures compared to its previous dates (yesterday).

2) Return the result table in any order.

 

💡 풀이

SELECT b.id AS Id
FROM Weather AS a 
    join Weather AS b ON DATEDIFF(b.recordDate, a.recordDate) = 1
WHERE b.temperature > a.temperature

 

댓글