Want to list all tables that contain a specific column name in MySQL? To get all tables with columns columnA or ColumnB in the database YourDatabase:
1 2 3 4 5 6 7 | SELECT DISTINCT TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME IN('column1', 'column2') AND TABLE_SCHEMA = 'schema_name'; |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.