fancyPants
fancyPants

Reputation: 51868

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.

Upvotes: 0

Views: 451

Answers (2)

Yarek T
Yarek T

Reputation: 9925

You can do this from PHP. Connect to the database and browse the mysql table. It will have all table definitions, then run DESCRIBE on each table, that will get you the structure.

I can give you some code examples if you like

Upvotes: 0

Vladislav Rastrusny
Vladislav Rastrusny

Reputation: 29965

Query INFORMATION_SCHEMA database for this.

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

Upvotes: 1

Related Questions