Selective MySQL clean up procedure

Asked By 0 points N/A Posted on -
qa-featured

Hi experts,

I would love to delete some entries in my database then clean it but don't want to delete all the entries before cleaning.

What is the mysql clean up procedure without deleting all the entries?

SHARE
Answered By 0 points N/A #166695

Selective MySQL clean up procedure

qa-featured

Hello,

Because you don't want to delete all the entries, you will have to tell the delete command not to do so. For example you can use the where clause¾ ORDER BY and Limit in delete statement.
 
The WHERE clause will specify the conditions for the rows to be deleted.  
 
If you do not use WHERE clause all rows would be deleted.  The LIMIT clause places a limit on the number of rows that can be deleted.  When the DELETE statement includes an ORDER BY clause the rows would be deleted in the order specified by the clause. Please check TabC.txt attached to this message for more information.
 
Another solution is to copy your table to another table clean or delete all the entries from the original table.
Now extract the rows that you want from the other table and put them back in the original one.
 
I hope this is useful.
 

Related Questions