如何在 Oracle SQL 中显示索引

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28611966/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 03:18:47  来源:igfitidea点击:

How to show indexes in Oracle SQL

sqloracle

提问by rahul.tripathi

I have created an index in Oracle SQl-

我在 Oracle SQL 中创建了一个索引-

create index ind_cname on country(capital)

在国家(首都)上创建索引 ind_cname

When executed I got a success message.Now I want to see the created Index. Please help in the syntax to show index.

执行时,我收到一条成功消息。现在我想查看创建的索引。请帮助显示索引的语法。

I am new to Oracle .I want a query which shows indexes for the table.

我是 Oracle 的新手。我想要一个显示表索引的查询。

Thanks

谢谢

回答by Entalyan

If you have the privileges, you can use the ALL_INDEXES or USER_INDEXES views. The query would be:

如果您有权限,您可以使用 ALL_INDEXES 或 USER_INDEXES 视图。查询将是:

SELECT  *
FROM    all_indexes
WHERE   table_name = 'COUNTRY';

If you want some information on the columns included in the index, you can select those from ALL_IND_COLUMNS. Documentation regarding these views can be found here Static Data Dictionary Views: ALL_ALL_TABLES to ALL_MVIEWS

如果您需要有关索引中包含的列的一些信息,您可以从 ALL_IND_COLUMNS 中选择这些信息。可以在此处找到有关这些视图的文档静态数据字典视图:ALL_ALL_TABLES 到 ALL_MVIEWS