Find MySQL tables with column name


Find all MySQL tables with column name foo:

SELECT TABLE_NAME, COLUMN_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMN_NAME = 'foo';

Find all MySQL tables with column name bar or baz:

SELECT TABLE_NAME, COLUMN_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMN_NAME IN ('bar', 'baz');

Find all MySQL tables with column name containing qux:

SELECT TABLE_NAME, COLUMN_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMN_NAME LIKE '%qux%';


Please support this site and join our Discord!