Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I find if a column is auto_increment in mysql?

Tags:

database

mysql

I'm trying to inspect my mysql database information_schema to find out the attributes of the columns. I can't find where the details as to which columns are auto_increment. Does anyone know where I can find this info in the information_schema DB?

like image 537
Glenn Slaven Avatar asked Jan 22 '09 10:01

Glenn Slaven


1 Answers

see the EXTRA column in the COLUMNS table:

select * from COLUMNS where  TABLE_SCHEMA='yourschema' and TABLE_NAME='yourtable' and EXTRA like '%auto_increment%'
like image 163
jscoot Avatar answered Oct 18 '22 18:10

jscoot