Problem
Example
Thinking
์ด๋ฒ์ ๋ฐฐ์ด ํจ์๊ฐ ์๋ค DATEDIFF
DATEDIFF(date1, date2) ๋ ๊ณง date1 - date2 ์ด๋ค
์์ ๋ฌธ์ ์์๋ ๋ค์๋ ์ ๋ฐ์ดํฐ์ ๋น๊ต๋ฅผ ํด์ผํ๋ ๊ฒ์ด๋ ํ๋ฃจ ์ฐจ์ด์ด๋ค.
๊ทธ๋ผ DATEDIFF(today.recordDate, yesterday.recordDate) = 1 ์ด๋ผ๊ณ ์ ์ด์ค ์ ์๋ค.
Solve
์ ์ถ ๋ต์
SELECT today.id
FROM Weather AS today
JOIN Weather AS yesterday ON DATEDIFF(today.recordDate, yesterday.recordDate) = 1
WHERE today.temperature > yesterday.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
'๐ป leetcode > database' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[LeetCode] Database | 620. Not Boring Movies (0) | 2022.01.13 |
---|---|
[LeetCode] Database | 596. Classes More Than 5 Students (0) | 2022.01.12 |
[LeetCode] Database | 627. Swap Salary (0) | 2022.01.05 |
[LeetCode] Database | 196. Delete Duplicate Emails (0) | 2022.01.03 |
[LeetCode] Database | 183. Customers Who Never Order (0) | 2022.01.02 |