SQL: deleting tables with prefix

后端 未结 10 1399
后悔当初
后悔当初 2020-11-30 17:27

How to delete my tables who all have the prefix myprefix_?

Note: need to execute it in phpMyAdmin

10条回答
  •  无人及你
    2020-11-30 18:01

    SELECT CONCAT("DROP TABLE ", table_name, ";") 
    FROM information_schema.tables
    WHERE table_schema = "DATABASE_NAME" 
    AND table_name LIKE "PREFIX_TABLE_NAME%";
    

提交回复
热议问题