문제
SQLite
내가 작성한 정답
select today.measured_at today, next.measured_at next_day,
today.pm10, next.pm10 next_pm10
from measurements today
join measurements next
on date(today.measured_at,'+1 day') = next.measured_at
where today.pm10 < next.pm10
SQLite에서 날짜 더하기
- 년 더하기 date(column, ‘+1 year’)

- 월 더하기 date(column, ‘+1 month’)

- 일 더하기 date(column,’+1 day’)

SQLite에서 날짜 빼기
: 특정 일 수를 더하거나 빼는 거라면 위의 방법과 같이
date(컬럼, ‘+-일,월,년 day,month,year ‘)로 작성하면된다.
SELECT (julianday(date1) - julianday(date2)) AS date_difference
FROM table;

SELECT
strftime('%Y', date1) - strftime('%Y', date2) AS year_difference,
strftime('%m', date1) - strftime('%m', date2) AS month_difference,
strftime('%d', date1) - strftime('%d', date2) AS day_difference
FROM table;
MYSQL에서 날짜 더하기
DATE_ADD('2025-03-01', INTERVAL 1 DAY)
// month, year도 같은 방식으로 하면 된다
- 년 더하기

- 월 더하기

- 일 더하기

ORACLE에서 날짜 더하기
- 년 더하기 : + interval ‘년’ year

3. 일 더하기 : datetime형식에 그냥 더하면 된다.

- 월 더하기 : 1) add_months(column, 월) 2) interval ‘월’ month


Share article