Show indexes for a table with MySQL
by Rekha[ Edit ] 2010-01-28 13:54:22
MySQL has a SQL query "SHOW INDEX FROM" which returns the indexes from a table.This query is used to get a list of indexes and a list of primary keys for a table with MySQL.
Syntax:
SHOW INDEXES FROM table_name;
Show the primary keys
To just show the primary key for the table run this query:
SHOW INDEXES FROM table_name WHERE Key_name = "PRIMARY";