MySQL - How to list all tables that contain a specific column name?
How to list all tables that contain a specific column name in MySQL?
You want to look for tables using the name of columns in them.
SELECT DISTINCT
TABLE_NAME
FROM
INFORMATION_SCHEMA.COLUMNS
WHERE
COLUMN_NAME IN('column1', 'column2')
AND TABLE_SCHEMA = 'schema_name';
Or a more simple way:
SELECT
*
FROM
information_schema.columns
WHERE
column_name = 'column_name';
Need a good GUI Tool for MySQL? TablePlus is a modern, native tool with an elegant UI that allows you to simultaneously manage multiple databases such as MySQL, PostgreSQL, SQLite, Microsoft SQL Server and more.
Not on Mac? Download TablePlus for Windows.
On Linux? Download TablePlus for Linux
Need a quick edit on the go? Download TablePlus for iOS.