Created
April 17, 2011 23:12
-
-
Save mateusg/924582 to your computer and use it in GitHub Desktop.
MySQL query to search for columns by name in a database
This file contains 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 Query | |
-- Search all tables from a database for columns that the name matches 'user_id'. | |
SELECT table_name, column_name FROM information_schema.columns | |
WHERE table_schema = 'database_name' AND column_name LIKE '%user_id%'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment