Skip to main content

SQL query to delete all rows older than 30 days

You can delete all rows from table which are older than 30 days. You have to use where created_at < now() - interval 30 DAY to get the records which are older than the 30 days from current date and Delete statement will delete It.

  • Delete 30 days older records from table using SQL query

    Syntax: 

    Delete from <table> where <date_column> < now() - interval 30 DAY

    SQL Query Example:

    Delete from Users where created_at < now() - interval 30 DAY

     

    This SQL query helps you to delete the 30 days older records from today's date from a table.

  • Back to code snippet queries related sql