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

后端 未结 10 2501
野趣味
野趣味 2021-02-13 03:22

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条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-13 03:46

    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

提交回复
热议问题