How do I delete all the entries in a phpmyadmin table without deleting each one manually?
Is there a way to delete a large amount of entries (but not all) from a phpmyadmin table without doing it manually?
thanks
| SitePoint Sponsor |




How do I delete all the entries in a phpmyadmin table without deleting each one manually?
Is there a way to delete a large amount of entries (but not all) from a phpmyadmin table without doing it manually?
thanks
To delete all entries in a table you can use the "Empty" button. To delete certain records only use a DELETE query, build the DELETE query as a SELECT query first to make sure that you'll only be deleting what you expect to be deleted. Once you've triple checked and check again that only what you expected to be deleted has been selected, convert the SELECT query to a DELETE query
Community Team Advisor
Forum Guidelines: Posting FAQ Signatures FAQ Self Promotion FAQ
Help the Mods: What's Fluff? Report Fluff/Spam to a Moderator


use this, it's easier --Code:TRUNCATE TABLE mytable




Thanks for your replies.
Truncate table my table is used for which scenario?
There's a table where I just want to keep the admin entry and remove all the rest. Is there any easy way to do that?




Nobody seems to have mentioned that in a phpMyAdmin table, if you go to 'Browse' and scroll to the bottom you can click 'Check All' to select all the records, and then click 'Delete' (also at the bottom). If you want to keep some individual records, uncheck them (on the left of each record) before deleting.
And make a copy of the table first, just in case.
Tim Dawson
Isle of Mull, Scotland
Bookmarks