There is some MySQL attribute to Decrement day, month, year or time in the same database that would automatically be.
Ex: column-> Initial value = 15, after one day it would be 14
Does the mysql database do this?
There is some MySQL attribute to Decrement day, month, year or time in the same database that would automatically be.
Ex: column-> Initial value = 15, after one day it would be 14
Does the mysql database do this?
Automatically does not, but there are some approaches to doing this.
The simplest is to implement in the query that does the update, here is an example:
UPDATE tabela SET
campo1 = 'Teste',
campoData = DATE_ADD(campoData, INTERVAL -1 DAY)
WHERE
(id = 1);
You can create a trigger or event (Trigger only occurs when an operation is triggered, type insert, delete, update) to perform this operation daily, for example:
CREATE EVENT event1
ON SCHEDULE EVERY '1' DAY
DO
-- sua operação aqui, por exemplo:
UPDATE TABELA SET CAMPODATA = str_to_date( date_format(now(), '%Y%m%d 0200'), '%Y%m%d %H%i' ) - INTERVAL 1 DAY
END