DROP TABLE (
SELECT table_name
FROM information_schema.`TABLES`
WHERE table_schema = \'myDatabase\' AND table_name LIKE BINARY \'del%\');
I know th
A minor improvement to @Devart's answer:
SET @tables = NULL;
SELECT GROUP_CONCAT(table_schema, '.`', table_name, '`') INTO @tables FROM
(select * from
information_schema.tables
WHERE table_schema = 'myDatabase' AND table_name LIKE 'del%'
LIMIT 10) TT;
SET @tables = CONCAT('DROP TABLE ', @tables);
select @tables;
PREPARE stmt1 FROM @tables;
EXECUTE stmt1;
DEALLOCATE PREPARE stmt1;
This script should be executed repeatedly until the console's output is NULL
The changes are:
LIMIT to avoid the truncation issue I commented aboutselect @tables;) to have some kind of control when to stop executing the script