The SQL statement in mysql increases the date by one year.
Some fields in the mysql table display dates. Due to various needs, it needs to be adjusted one year later.
The statement for updating the statement added by one year on the mysql date is as follows:
UPDATE table SET date = DATE_ADD(date, INTERVAL 1 YEAR)
If you want to add one DAY, the next 1 YEAR is changed to 1 DAY, and January is 1 MONTH.
Note that if it is multiple years or more months or multiple days, such as 3 years
It is followed by three years and does not need to be plural. So do not write it as a fan of 3 YEARS Novell.
The mysql date has been increased by one year, and May 1, January, with more than one month and more than one day! All rights reserved. it cannot be reproduced without the consent of Novell fans!
What if we want to go forward? Write the number as a negative number. If the value is less than one YEAR, the value is-1 YEAR.
Note that you can also write select statements, such
SELECT OrderId, DATE_ADD (OrderDate, INTERVAL 45 DAY) AS OrderPayDate
FROM Orders
This is only displayed temporarily during your query. Does not actually update data in the database.