Develop/Database
[Leetcode] 197. Rising Temperature (MySQL) 문제 및 풀이
초코칩프라푸치노
2021. 12. 20. 18:29
문제) Leetcode - SQL - 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
전날보다 높은 기온을 가지는 날을 찾는 문제였습니다. w1과 w2 두 개의 테이블을 이용하여 temperature의 비교와 datediff를 이용하여 해결합니다.
풀이)
select w1.id
from Weather w1, Weather w2
where w1.temperature> w2.temperature and datediff(w1.recordDate, w2.recordDate) = 1;
반응형