要获取数据库中的列columnA
或ColumnB
所有表YourDatabase
:
SELECT DISTINCT TABLE_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMN_NAME IN ('columnA','ColumnB')
AND TABLE_SCHEMA='YourDatabase';
SELECT TABLE_NAME, COLUMN_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMN_NAME LIKE '%wild%';
更简单地在一行 SQL 中完成:
SELECT * FROM information_schema.columns WHERE column_name = 'column_name';