YaoRaoLov 2008-10-11 07:02 采纳率: 50%
浏览 185
已采纳

如何在 MySQL 中找到所有有特定列名的表?

I have 2-3 different column names that I want to look up in the entire DB and list out all tables which have those columns. Any easy script?

转载于:https://stackoverflow.com/questions/193780/how-to-find-all-the-tables-in-mysql-with-specific-column-names-in-them

  • 写回答

9条回答 默认 最新

  • Memor.の 2008-10-11 08:42
    关注

    To get all tables with columns columnA or ColumnB in the database YourDatabase:

    SELECT DISTINCT TABLE_NAME 
        FROM INFORMATION_SCHEMA.COLUMNS
        WHERE COLUMN_NAME IN ('columnA','ColumnB')
            AND TABLE_SCHEMA='YourDatabase';
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(8条)

报告相同问题?