Is it possible, from the MySQL command line, to list in a single query all the indexes/constraints/FKs etc that are in the database in question?

Thanks in advance

Rich

link|improve this question

68% accept rate
feedback

2 Answers

Take a look into information_schema database, maybe these tables can help you:

  • REFERENTIAL_CONSTRAINTS
  • COLUMNS table (column COLUMN_KEY)
link|improve this answer
feedback

We can also refer to INFORMATION_SCHEMA.TABLE_CONSTRAINTS dictionary table providing TABLE_SCHEMA and CONSTRAINT_TYPE in where clause/

CONSTRAINT_TYPE could be 'UNIQUE'/'PRIMARY KEY'/FOREIGN KEY'

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.