1、查找一个表的主键和索引极其它们的字段
- 查主键名称:
select CONSTRAINT_NAME from user_constraints where table_name ='abc' and constraint_type ='P';
查主键对应的列:
select COLUMN_NAME from user_cons_columns where table_name = 'abc' and constraint_name = 'PK_ART'; -
查索引名称:
select INDEX_NAME from user_indexes where table_name = 'abc' ;
查索引对应的列:
select COLUMN_NAME from user_ind_columns where table_name = 'abc' and index_name = 'INDX_BA';
本文介绍如何使用SQL查询指定表的主键名称及其对应字段,同时提供查询索引名称及其对应字段的方法。

被折叠的 条评论
为什么被折叠?



