[LeetCode] 197. Rising Temperature

단간단간·2024년 4월 2일

SQL 문제

목록 보기
8/12

문제 링크:

https://leetcode.com/problems/rising-temperature/description/?envType=study-plan-v2&envId=top-sql-50

회고:

  • MySQL에서 날짜 계산하는 함수, DATE_ADDDATE_SUB
  • DATE_ADD: 날짜에서 일정 기간을 더할 때
  • DATE_SUB: 날짜에서 일정 기간을 더할 때
  • 예시) 현재 날짜에서 10일을 더하는 경우: DATE_ADD(NOW(), INTERVAL 10 DAY)

MySQL

SELECT A.id
FROM Weather A
INNER JOIN Weather B ON DATE_ADD(B.recordDate, INTERVAL 1 DAY) = A.recordDate
WHERE A.temperature > B.temperature
profile
simple is best

0개의 댓글