Delete all data from a table, without deleting the structure.|
TAGS: MySQL, Table, PHP, TRUNCATE
We return briefly to SQL'ing, to look at an example on how to delete all content in a table. ..
So now we have filled up our table 'contacts' with a lot of tests. We are ready to use the database for real things, and we want to delete every row in the table.
How is that done?
Here is a solution that deletes everything without messing up the structure.
As you see in the above example deleting all content is quite simple. Again SQL is our friend and provide the TRUNCATE with which we can clean out the table.