SELECTDISCTTABLE_NAME ->FROMINFORMATION_SCHEMA.COLUMNS ->WHERECOLUMN_NAMEIN('EMAIL') ->ANDTABLE_SCHEMA='SAMPLE"/> SELECTDISCTTABLE_NAME ->FROMINFORMATION_SCHEMA.COLUMNS ->WHERECOLUMN_NAMEIN('EMAIL') ->ANDTABLE_SCHEMA='SAMPLE">
The following statement shows a list of two tables with an "email" column in the 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)
The above is the detailed content of How to check MySQL table from database based on specific column name?. For more information, please follow other related articles on the PHP Chinese website!