How can I delete the contents of all tables in my database in phpMyAdmin without dropping the database?

后端 未结 10 1376
予麋鹿
予麋鹿 2021-02-13 03:32

How can I empty the contents of all tables in my database in phpMyAdmin without dropping any of the tables in the database?

Since I do this several times an hour while i

10条回答
  •  执笔经年
    2021-02-13 03:57

    you could start with this query

    SELECT T.*
    FROM INFORMATION_SCHEMA.tables T
    WHERE T.table_type = 'BASE TABLE'
    

    And iterate through those results to build a dynamic SQL string to the tune of 'DELETE FROM ' + T.Table_Name

提交回复
热议问题