MySQL批量删除表在哪里表像? [英] MySQL bulk drop table where table like?

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

问题描述

DROP TABLE (
SELECT table_name
FROM information_schema.`TABLES`
WHERE table_schema = 'myDatabase' AND table_name LIKE BINARY 'del%');

我知道这行不通!在SQL中类似这样的东西是什么?我可以简单地编写一个Python脚本来执行此操作,但我只是想知道我们是否可以直接使用SQL进行操作.我正在使用MySQL.谢谢!

I know this doesn't work! What is the equivalent for something like this in SQL? I can whip out a simple Python script to do this but was just wondering if we can do something with SQL directly. I am using MySQL. Thank you!

推荐答案

您可以使用它将生成并执行这样的语句-

It will generate and execute a statement like this -

DROP TABLE myDatabase.del1, myDatabase.del2, myDatabase.del3;

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

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