0%

MySQL查看表索引

查看表索引

1
2
3
4
5
6
7
8
SELECT a.TABLE_SCHEMA,
    a.TABLE_NAME,
    a.INDEX_NAME,
    GROUP_CONCAT(COLUMN_NAME ORDER BY SEQ_IN_INDEX) AS `Columns`
FROM information_schema.statistics a
WHERE TABLE_SCHEMA = '数据库名'
GROUP BY a.TABLE_SCHEMA,a.TABLE_NAME,a.INDEX_NAME
ORDER BY a.TABLE_NAME;