用mysql查询某字段是否有索引怎么做?

2025-02-24 09:48:14
推荐回答(2个)
回答1:

显示一个表所有索引的SQL语句是:

show index from 数据库名.表名

查看某表某一列上的索引使用下面的SQL语句:

show index from 数据库名.表名 where column_name like '列名'

下面的SQL语句在我的数据库上执行成功:

show index from web.clubuser where column_name like 'user'。

回答2:

显示一个表所有索引的SQL语句是:
show index from 数据库名.表名

查看某表某一列上的索引使用下面的SQL语句:
show index from 数据库名.表名 where column_name like '列名'

下面的SQL语句在我的数据库上执行成功:
show index from web.clubuser where column_name like 'user'