在oracle中查询已知表名的表中所有字段名,每个字段是否是主键,是否是外键,是否为空的sql语句,在线等。

[复制链接]
查看11 | 回复2 | 2010-12-20 17:44:26 | 显示全部楼层 |阅读模式
如现在有表women,我想知道表里边每个字段的属性名称,属性定义,数据域,是否主键,是否外键,是否可空。sql应该如何写?谢谢,请尽快答复。

回复

使用道具 举报

千问 | 2010-12-20 17:44:26 | 显示全部楼层
查询表的所有列及其属性:selectt.*,c.COMMENTS from user_tab_columnst,user_col_commentsc where t.table_name = c.table_name and t.column_name = c.column_name and t.table_name = women;查找表的主键:select cu.* from user_cons_columns cu, user_constraints au where cu.constraint_name = au.constraint_name and au.constraint_type = 'P' a
回复

使用道具 举报

千问 | 2010-12-20 17:44:26 | 显示全部楼层
最简单的直接查看表不就行了edit tablename
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行