6 May 2011

This query example shows how to delete rows older than x amount of minutes, hours, days, months or even years. This is a part of MySQL date and time functions.

Source code viewer
  1. -- Time interval is always singular.
  2. DELETE FROM table WHERE date_col_name < now() - interval 3 day
Programming Language: MySQL