在mysql中一键删除多个表 [英] Drop multiple tables in one shot in mysql

查看:88
本文介绍了在mysql中一键删除多个表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何通过一个命令从一个数据库中删除多个表. 像

How to drop multiple tables from one single database at one command. something like,

> use test; 
> drop table a,b,c;

其中a,b,c是来自数据库测试的表.

where a,b,c are the tables from database test.

推荐答案

示例:

比方说表A有两个子B和C.然后我们可以使用以下语法删除所有表.

Let's say table A has two children B and C. Then we can use the following syntax to drop all tables.

DROP TABLE IF EXISTS B,C,A;

可以将其放置在脚本的开头,而不必分别删除每个表.

This can be placed in the beginning of the script instead of individually dropping each table.

这篇关于在mysql中一键删除多个表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆