Not sure if I've recorded this simple but useful query before (my memory sucks these days).
Say we want to find all the tables in a MySQL schema called 'dwh_inventory' that have a column with the word 'snapshot' in, what do we do?
Easy:
SELECT TABLE_NAME, COLUMN_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMN_NAME LIKE '%snapshot%'
AND TABLE_SCHEMA = 'dwh_inventory';
Comments
Post a Comment