How can I check MySQL tables from a database in accordance with particular
column/s name?



The following statement shows the list of two tables having a column ‘email’ in Sample database −

mysql> SELECT DISTINCT TABLE_NAME
    -> FROM INFORMATION_SCHEMA.COLUMNS
    -> WHERE COLUMN_NAME IN('EMAIL')
    -> AND TABLE_SCHEMA = 'SAMPLE';
+---------------+
| TABLE_NAME    |
+---------------+
| employee      |
| new_student   |
+---------------+
2 rows in set (0.04 sec)

Advertisements