Last active
July 1, 2019 09:20
-
-
Save rbrooks/5b1779dd16d24b314f7d0558527b7614 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- MySQL | |
-- Search all tables, databse-wide, for a column name. | |
-- EXACT MATCH | |
SELECT DISTINCT TABLE_NAME | |
FROM INFORMATION_SCHEMA.COLUMNS | |
WHERE COLUMN_NAME IN ('col_name') | |
AND TABLE_SCHEMA='db_name'; | |
-- PARTIAL MATCH | |
SELECT DISTINCT TABLE_NAME | |
FROM INFORMATION_SCHEMA.COLUMNS | |
WHERE COLUMN_NAME LIKE ('%partial_name%') | |
AND TABLE_SCHEMA='db_name'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment