Click here to Skip to main content
15,911,646 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to delete all tables without deleting structure in db with single query...
Posted

You have to use TRUNCATE TABLE or DELETE statement on each table in the database. There is no way to wipe out all data in a database in a single statement.
 
Share this answer
 
to empty a table in mysql use the truncate statement
see: http://dev.mysql.com/doc/refman/5.6/en/truncate-table.html[^]

the query:
SQL
SELECT Concat('TRUNCATE TABLE ', TABLE_NAME) FROM INFORMATION_SCHEMA.TABLES

(found in 2 minutes via Google)
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900