在整个MySQL数据库中查找
select * from INFORMATION_SCHEMA.columns where COLUMN_NAME Like '%placement%';
在特定数据库中查找
SELECT DISTINCT TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME IN ('ColumnA','ColumnB') AND TABLE_SCHEMA='DatabaseName';
SELECT DISTINCT TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME LIKE '%ColumnA%' AND TABLE_SCHEMA='DatabaseName';
在特定数据库中查找包含A和B字段的表
SELECT DISTINCT * FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME IN ('A') and TABLE_NAME in
(SELECT DISTINCT TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME IN ('B') AND TABLE_SCHEMA='DatabaseName')
评论 (0)