mysql:
show index from v3x_affair;
sqlserver:
1.0 查到表名和索引名
select a.name as tabname
,h.name as idname
from sys.objects as a
right join sys.indexes as h on a.object_id=h.object_id
where a.type<>'s' and a.name='要查的表名'
2.0 推荐方法
SELECT a.name,c.name,d.name --查看索引名,表名,设置字段名
FROM sysindexes a
JOIN sysindexkeys b ON a.id=b.id AND a.indid=b.indid
JOIN sysobjects c ON b.id=c.id
JOIN syscolumns d ON b.id=d.id AND b.colid=d.colid
WHERE a.indid NOT IN(0,255)
-- and c.xtype='U' and c.status>0 --查所有用户表
AND c.name='v3x_affair' --查指定表
ORDER BY c.name,a.name,d.name ;
oracle:
select t.*,i.index_type from user_ind_columns t,user_indexes i where t.index_name = i.index_name and t.table_name = i.table_name and t.table_name = 要查询的表