SQL DATE_ADD Function Guide

The DATE_ADD function in SQL is used to add a specific time interval to a date or datetime value. Its syntax is as follows:

DATE_ADD(date, INTERVAL expr unit)

date is the date or datetime value to which the interval time is to be added, expr is the value of the interval to be added, and unit is the unit of the interval (e.g. YEAR, MONTH, DAY, HOUR, MINUTE, SECOND, etc.).

For example, to add three months to a date field, you can use the following SQL statement:

SELECT DATE_ADD(date_column, INTERVAL 3 MONTH) FROM table_name;

This will return the date that is 3 months after the original date.

bannerAds