亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

MySql批量刪除多個(gè)表的方法

 更新時(shí)間:2023年06月09日 10:15:37   作者:可樂(lè)漢堡cola  
本文主要介紹了MySql批量刪除多個(gè)表的方法,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧

項(xiàng)目場(chǎng)景:

使用Navicat工具直接在界面中刪除,只能單張表刪除,不能多選。

解決方案:

我們可以通過(guò)MySQL的語(yǔ)句來(lái)批量刪除多個(gè)表,其中test替換成你要查詢的數(shù)據(jù)庫(kù)名字。

1.生成刪除某個(gè)數(shù)據(jù)庫(kù)下所有的表SQL

-- 查詢構(gòu)建批量刪除表語(yǔ)句(根據(jù)數(shù)據(jù)庫(kù)名稱)
select concat('drop table ', TABLE_NAME, ';') from information_schema.TABLES
where TABLE_SCHEMA = 'test';

2.生成刪除某個(gè)數(shù)據(jù)庫(kù)下指定的表名SQL

-- 查詢構(gòu)建批量刪除表語(yǔ)句(根據(jù)數(shù)據(jù)庫(kù)中的表名稱模糊查詢)
select concat('drop table ', TABLE_NAME, ';') from information_schema.TABLES
where TABLE_SCHEMA = 'test' and TABLE_NAME like 'sys_%';

復(fù)制查出來(lái)的刪除sql語(yǔ)句,并批量執(zhí)行。

drop table sys_dept;
drop table sys_dict;
drop table sys_log;
drop table sys_log_2022;
drop table sys_menu;
drop table sys_notice;
drop table sys_role;
drop table sys_role_menu;
drop table sys_user;
drop table sys_user_dept;
drop table sys_user_role;
drop table sys_user_token;

到此這篇關(guān)于MySql批量刪除多個(gè)表的方法的文章就介紹到這了,更多相關(guān)MySql批量刪除表內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評(píng)論