IT/MySQL(MariaDB)

Find specific column names from all tables.

쓸만한게없네 2015. 9. 12. 14:06

Find specific column names from all tables.

SELECT DISTINCT TABLE_NAME 

    FROM INFORMATION_SCHEMA.COLUMNS

    WHERE COLUMN_NAME IN ('columnA','ColumnB')

        AND TABLE_SCHEMA='YourDatabase';


ex.

SELECT *

    FROM INFORMATION_SCHEMA.COLUMNS

    WHERE COLUMN_NAME like '%code%'

        AND TABLE_SCHEMA='world';