我有 2-3 个不同的列名,我想在整个数据库中查找并列出所有包含这些列的表.有没有简单的脚本?
I have 2-3 different column names that I want to look up in the entire database and list out all tables which have those columns. Is there any easy script?
获取YourDatabase
数据库中包含columnA
或ColumnB
列的所有表>:
To get all tables with columns columnA
or ColumnB
in the database YourDatabase
:
SELECT DISTINCT TABLE_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMN_NAME IN ('columnA','ColumnB')
AND TABLE_SCHEMA='YourDatabase';
这篇关于如何在 MySQL 中找到包含特定列名的所有表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!