Hi I have Amazon rds which i can connect to using the mysql prompt
I want to empty a table using the prompt command line
What's the best way to do the above? Thanks!
Hi I have Amazon rds which i can connect to using the mysql prompt
I want to empty a table using the prompt command line
What's the best way to do the above? Thanks!
You can use the standard truncate
command to empty the required tables. If you want to truncate multiple tables follow this question.
Try
DELETE FROM `table_name`;
Notice the missing where clause, this will delete all rows.
Data can't be deleted that's connected by a constraint.
What you need is code that first removes constraints, then deletes the data, and finally restores the constraints:
Moreover, use DELETE
command as you can ROLLBCK
the operation. While using truncate
, operation cannot be rolled back and no triggers will be fired