MySQL 如何查找具有特定列名的表
要查找列名,请使用information_schema.columns。以下是语法 –
select distinct table_name
from information_schema.columns
where column_name like '%yourSearchValue%'
and table_schema=database();
让我们实现上述语法以查找各个表中的列名。这里,我们只想要带有特定列名单词“Client”的表名 –
mysql> select distinct table_name
from information_schema.columns
where column_name like '%Client%'
and table_schema=database();
这将产生以下输出 –
+----------------+
| table_name |
+----------------+
| demotable449 |
| demotable450 |
| demotable461 |
| demotable517 |
| demotable529 |
| demotable534 |
| demotable537 |
| demotable543 |
| demotable547 |
+----------------+
9 rows in set (1.19 sec)
现在,让我们检查任何表并查找列名中带有“Client”单词的内容 –

阅读更多:MySQL 教程
极客教程