Skip to content

Latest commit

 

History

History
13 lines (11 loc) · 322 Bytes

drop_multiple_tables.md

File metadata and controls

13 lines (11 loc) · 322 Bytes

To drop multiple tables with a specific pattern prefix use

SET group_concat_max_len = 5000;
SELECT CONCAT('DROP TABLE ', GROUP_CONCAT(table_name), ';')
       INTO @droplike
FROM information_schema.tables
WHERE table_name LIKE 'pattern_%';

PREPARE stmt FROM @droplike;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;