I have a problem in Automatically delete row after 10 ninutes after creation - Databases using php
Asked
Active
Viewed 929 times
-5
-
1you need a cron job. – May 22 '19 at 22:06
-
Or a [MySQL event](https://dev.mysql.com/doc/refman/8.0/en/events-overview.html) – May 22 '19 at 22:23
-
@Strawberry Ah yes, making fun of people. That will help them. – I try so hard but I cry harder Jan 05 '20 at 21:13
1 Answers
0
Assuming the table has a creation_time
column, the following query will delete the old rows:
DELETE FROM table_name WHERE creation_time < DATE_SUB(NOW(), INTERVAL 10 MINUTE);
You can run this periodically using the MySQL Event Scheduler.

Barmar
- 741,623
- 53
- 500
- 612