Thursday, December 15, 2011

MySQL

Getting lazy to look for a column name in some table?  Look no further:

SELECT DISTINCT TABLE_NAME FROM information_schema.columns WHERE COLUMN_NAME LIKE '%blabla%' AND TABLE_SCHEMA='YourDatabase';

Compounding the laziness: search for a column in a large table with:

SELECT * FROM information_schema.`COLUMNS` C  where table_name = 'your_table_name' and C.Column_Name like '% blabla %'

0 comments: