MySQLDate/Time FunctionsDATE_SUB
DATE_ADD

DATE_SUBDate/Time Functions

DATEDIFF

Subtracts an interval from a date.

Syntax

DATE_SUB(date, INTERVAL n unit)

Example

Enter values below to update the example in real time.

orders
order_date
-- 30일 이전 주문 조회
SELECT *
FROM orders
WHERE order_date >= DATE_SUB(CURDATE(), INTERVAL 30 DAY);