SELECTDISCTTABLE_NAME ->FROMINFORMATION_SCHEMA.COLUMNS ->WHERECOLUMN_NAMEIN('EMAIL') ->ANDTABLE_SCHEMA='SAMPLE"/> SELECTDISCTTABLE_NAME ->FROMINFORMATION_SCHEMA.COLUMNS ->WHERECOLUMN_NAMEIN('EMAIL') ->ANDTABLE_SCHEMA='SAMPLE">

Home  >  Article  >  Database  >  How to check MySQL table from database based on specific column name?

How to check MySQL table from database based on specific column name?

PHPz
PHPzforward
2023-09-06 18:17:121219browse

如何根据特定列名称从数据库中检查 MySQL 表?

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!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete