MySQL删除表 [英] MySQL Dropping Tables

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

问题描述

我将使用哪种MySQL语法删除具有相似模式的多个表?像这样:

What syntax for MySQL would I use to drop multiple tables that have a similar pattern to them? Something like:

DROP TABLES FROM `Database1` LIKE "SubTable*"

推荐答案

否.但是您可以从information_schema数据库中选择表名称:

No. But you can select tables names from information_schema database:

select table_name
  from information_schema.tables
 where table_schema = 'Database1'
   and table_name like 'SubTable%'

然后在结果集中迭代表名并将其删除

And after that iterate the table names in result set and drop them

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

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