Reputation: 1130
There are huge tables in my mysql database, I want to get all the tables with auto increment columns and the columns' names. Could anyone teach me how to do that ?
Upvotes: 1
Views: 1531
Reputation: 6771
I think you can get that information from the COLUMNS
table in the INFORMATION_SCHEMA
schema.
E.g.
select TABLE_NAME, COLUMN_NAME from COLUMNS where `COLUMN_KEY` = 'PRI' and EXTRA like '%auto_increment%'
Upvotes: 2