1

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 ?

Angle Tom
  • 1,060
  • 1
  • 11
  • 29
  • 1
    Possible duplicate of [How to see indexes for a database or table in MySQL?](https://stackoverflow.com/questions/5213339/how-to-see-indexes-for-a-database-or-table-in-mysql) – Raymond Nijland Oct 21 '19 at 11:15
  • @RaymondNijland sorry, I don't think so. I am considering to get the information from information_schema.Columns. – Angle Tom Oct 21 '19 at 11:19

1 Answers1

1

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%'
brass monkey
  • 5,841
  • 10
  • 36
  • 61