oracle 用于显示表名、其结构和约束信息的 SQL 语句

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16420693/
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-19 01:38:36  来源:igfitidea点击:

SQL statement to display table names, its structures, and constraint information

sqldatabaseoracle

提问by Hyman

Im looking for an Oracle SQL statement that will show me all the table names, structures and constraint information that I have created.

我正在寻找一个 Oracle SQL 语句,它将显示我创建的所有表名、结构和约束信息。

Would it be something along the lines of

会不会是这样的

Select * from user_tables;

回答by Max

This is the official oracle query you should use to select the tables for the current user:

这是您应该用来为当前用户选择表的官方 oracle 查询:

  SELECT table_name FROM user_tables;

or

或者

SELECT table_name
  FROM dba_tables

or

或者

SELECT table_name
  FROM all_tables

for selecting all constraints for a table:

用于选择表的所有约束:

SELECT * FROM USER_CONSTRAINTS WHERE TABLE_NAME = ""

or

或者

SELECT * FROM USER_CONSTRAINTS WHERE TABLE_NAME='EMP';

(This will list you all the constraints from that particular user in which you are logged in.)

(这将列出您登录的特定用户的所有限制。)