How to select update dates with some interval day/month duration in mysql

This article focuses on following points

If you have 1 or more date field in your mysql database and you want to write select query to retrive that but, in the mean time you also want to add some days or months to existing dates

if you have 1 ore more date fields in your mysql database and you want to update all the records of that column with previous date value plus some interval like 1 day or 1 month or more.

Suppose i have 1 table called beneficiaries and in that beneficiaries table i have 1 column called delivery_date.

Previously delivery_date column contains some date.I want to write an update query so that existing date will change to some new date with 7 month addition.

UPDATE Query for date interval in mysql

Like if delivery_date date was 2010-12-10 then this will become 2011-09-10 after executing the query.

1
UPDATE beneficiaries SET delivery_date = delivery_date + INTERVAL 7 MONTH;

similarly i can change previous date to new date with some days addition like 7 Days.

1
UPDATE beneficiaries SET delivery_date = delivery_date + INTERVAL 7 DAY;

Same way i can write SELECT Query for date interval in mysql

1
SELECT delivery_date + INTERVAL 1 DAY FROM beneficiaries;
1
SELECT delivery_date + INTERVAL 1 MONTH FROM beneficiaries;