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

MySQLMySQLi Database

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)
raja
Published on 19-Feb-2018 07:25:04
Advertisements