Search code examples
mysqlinformation-schema

How to get list of tables, that don`t have a specific column in MySQL


I need to have a list of tables in MySQL, that don`t have a column 'created' or 'modified', so I can add them if non existant. How can I achieve this?

Thanks in advance for any help / hint.


Solution

  • Query INFORMATION_SCHEMA database for this.

    http://dev.mysql.com/doc/refman/5.1/en/information-schema.html