How to find a column name in all tables in MySQL


Sometimes, it could be handy to know in which tables a certain column name is specified. To do so, use the query below.

select distinct table_name
    from information_schema.columns
    where column_name in ('columnA','ColumnB')
        and table_schema = 'YourDatabase';

Note: you need to fill in your own column names and table_schema. Enjoy!

Add comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Tag Cloud