I need to know how to automatically insert a row with default values with a time condition (the script should evaluate if there is not a data entry from 1 minute and then insert the default row), how can I automate the script to to evaluate the time of last insertion first?
My table:
id int(11) PRIMARY KEY auto_increment
codigo_maquina tinyint(2)
corriente smallint(5)
velocidad smallint(5)
codigo_estado smallint(5)
estado char(20)
fecha_hora timestamp YES CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP
The query I want to leave as a defect would be like this:
INSERT INTO maquina(codigo_maquina, corriente, velocidad,
codigo_estado, estado) VALUES (1, 0, 0, 5, 'Fuera de Linea');
Thanks in advance!