(转)Oracle常用查看表结构命令

[b][color=red]获取表名称: [/color][/b]
select table_name from user_tables; //获取当前用户的表

select table_name from all_tables; //获取所有用户的表

select table_name from dba_tables; //获取包括系统表在内的所有表

select table_name from dba_tables where owner='用户名' //获取某用户下的所有表

[color=red]以上各表表结构[/color]
user_tables:
table_name,tablespace_name,last_analyzed等

dba_tables:
ower,table_name,tablespace_name,last_analyzed等

all_tables:
ower,table_name,tablespace_name,last_analyzed等

all_objects:
ower,object_name,subobject_name,object_id,created,last_ddl_time,timestamp,status等

[b][color=red]获取某用户表的字段信息: [/color][/b]
select * from user_tab_columns where Table_Name='用户表';

select * from all_tab_columns where Table_Name='用户表';

select * from dba_tab_columns where Table_Name='用户表';

[color=red]以上各表的主要字段:[/color]
user_tab_columns:

table_name,column_name,data_type,data_length,data_precision,data_scale,nullable,column_id等

all_tab_columns :

ower,table_name,column_name,data_type,data_length,data_precision,data_scale,nullable,column_id等

dba_tab_columns:

ower,table_name,column_name,data_type,data_length,data_precision,data_scale,nullable,column_id等

[b][color=red]获取表注释:[/color] [/b]
select * from user_tab_comments

user_tab_comments:table_name,table_type,comments

--相应的还有dba_tab_comments,all_tab_comments,这两个比user_tab_comments多了ower列。

[b][color=red]获取字段注释: [/color][/b]
select * from user_col_comments

user_col_comments:table_name,column_name,comments

[color=red][b]汇总[/b][/color]
select * from all_tables; //查询所有用户下的表信息
select * from all_tab_columns where owner='用户名' and table_name='表名';//表字段信息
select * from all_tab_comments where owner='用户名' and table_name='表名'//表注释信息
select * from all_col_comments where owner='用户名' and table_name='表名';//字段注释信息
表信息、表字段信息、表注释信息、字段注释信息
user_tables、user_tab_columns、user_tab_comments、user_col_comments
all_tables、all_tab_columns 、all_tab_comments、all_col_comments
dba_tables、dba_tab_columns、dba_tab_comments、dba_col_comments

[color=blue]转至:http://www.cnblogs.com/qingsong-do/archive/2011/11/29/2267244.html[/color]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值