SQL/MySQL

mysql 해당DB 의 전체 테이블 삭제

http://portfolio.wonpaper.net 2019. 6. 21. 20:04

SET @tables = NULL;
SELECT GROUP_CONCAT(table_schema, '.', table_name) INTO @tables
FROM information_schema.tables
WHERE table_schema = 'DB명';
SET @tables = CONCAT('DROP TABLE ', @tables);
PREPARE stmt FROM @tables;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;