
要查找两个特定的列名称,请使用 information_schema.columns 在这里,我使用 Id 代替 columnA,使用 Name 代替 columnB -
mysql> select table_name as TableNameFromWebDatabase
-> from information_schema.columns
-> where column_name IN ('Id', 'Name')
-> group by table_name
-> having count(*) = 3;这将产生以下输出。以下是包含 Id 和 Name 列的表格 -
+--------------------------+ | TableNameFromWebDatabase | +--------------------------+ | student | | distinctdemo | | secondtable | | groupconcatenatedemo | | indemo | | ifnulldemo | | demotable211 | | demotable212 | | demotable223 | | demotable233 | | demotable251 | | demotable255 | +--------------------------+ 12 rows in set (0.25 sec)
为了证明这一点,让我们检查其中一个表的描述。以下是查询 -
mysql> desc demotable233;
这将产生以下输出。在这里,您可以看到我们有 Int 和 Name 列 -
+-------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------+-------------+------+-----+---------+----------------+ | Id | int(11) | NO | PRI | NULL | auto_increment | | Name | varchar(20) | YES | | NULL | | +-------+-------------+------+-----+---------+----------------+ 2 rows in set (0.00 sec)
以上就是如何在MySQL中查找包含两个特定列的所有表?的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号