SQL query to delete all rows older than 30 days
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.
If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.
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.
Random Code Snippet Queries: Sql
- How to drop function in MySQL ?
- How to Rename column name in MySql ?
- Get number of connections being used by a specific user in MySQL
- How to create function in MySQL ?
- SQL query to delete records older than 6 months
- Create Employee table in MySQL
- Create Index in MySQL with example
- Clear the terminal screen in MySQL within the Windows powershell
- How to create view in MySQL database
- How to check column exists or not in table using MySQL
- SQLSTATE[01000]: Warning: 1265 Data truncated for column 'visibility' at row 1
- Change existing MySQL table column id to autoincrement
- How to show database tables in mysql using command line
- How to get yesterday's date in MySQL ?
- MySQL create procedure example
- How to retrieve data from two tables with one SQL statement
- Get comma separated ids from table using MySQL
- ERROR 3780 (HY000): Referencing column 'order_id' and referenced column 'id' in foreign key constraint 'order_items_ibfk_1' are incompatible.
- Database connection using mySQLi with object-oriented
- How to get the list of all constraints in MySQL database
- Create column after a column in existing table using query in MySQL
- Get data in random order with limit from table using mysql
- Check constraint in MySQL
- Difference between SQL and NoSQL databases
- Drop foreign id column (user_id) in MySQL