티스토리 뷰

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

 

LeetCode - The World's Leading Online Programming Learning Platform

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

with base as (
select
    id, recordDate, temperature 
    , lag(recordDate, 1) over (order by recordDate) last_d
    , lag(temperature, 1) over (order by recordDate) last_t
from weather
)
select
    distinct id
from base
where datediff(recordDate, last_d) = 1 and last_t < temperature

'프로그래밍연습 > SQL' 카테고리의 다른 글

[SQL]weather-observation-station-5  (0) 2023.08.25
[SQL]confirmation-rate  (0) 2023.08.22
[SQL]exchange-seats  (0) 2023.08.21
[SQL]friend-requests-ii-who-has-the-most-friends  (0) 2023.08.20
[SQL]game-play-analysis-iv  (0) 2023.08.19
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/04   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30
글 보관함