SQL query to delete all rows older than 30 days

Created at 21-Oct-2021 , By samar

SQL query to delete all rows older than 30 days

We’ll attempt to use programming in this lesson to solve the "SQL query to delete all rows older than 30 days" puzzle.

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

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Buy Me A Coffee

Don't forget to share this article! Help us spread the word by clicking the share button below.

We appreciate your support and are committed to providing you valuable and informative content.

We are thankful for your never ending support.