oracle怎么增加列注释

oracle怎么增加列注释,第1张

oracle怎么增加列注释

oracle中,可以利用“comment on column 表名.列名 is '列注释';”增加列注释;comment是注释的意思, comment on命令用于给表或字段加以说明,也即添加注释,column用于设置列的数据内容。

本教程 *** 作环境:Windows10系统、Oracle 11g版、Dell G3电脑。

oracle怎么增加列注释

给列加注释:

SQL>comment on column 表.列 is '列注释';

扩展:

1、给表填加注释:SQL>comment on table 表名 is '表注释";

2、给列加注释:SQL>comment on column 表.列 is '列注释';

3、读取表注释:SQL>select * from user_tab_comments where comments is not null;

4、读取列注释:SQL>select * from user_col_commnents where comments is not null and table_name='表名';

oracle中用comment on命令给表或字段加以说明,语法如下:

COMMENT ON
{ TABLE [ schema. ]
{ table | view }
| COLUMN [ schema. ]
{ table. | view. | materialized_view. } column
| OPERATOR [ schema. ] operator
| INDEXTYPE [ schema. ] indextype
| MATERIALIZED VIEW materialized_view
}
IS ‘text’ ;

用法如下:

1.对表的说明

comment on table table_name is ‘comments_on_tab_information’;

2.对表中列的说明

comment on column table.column_name is ‘comments_on_col_information’;

3.查看表的说明

SQL> select * from user_tab_comments where TABLE_NAME=’EMPLOYEES’;
TABLE_NAME TABLE_TYPE COMMENTS

添加注释的好处:

1.可以通过SQL语句快速查询,只要知道表名和字段名定位注释极方便快速。

2.注释内容是存储在字典表里的,只要表结构还在,那么SQL脚本即使没有了也可以定位查询。

3.不需要猜字段是什么意思,因为在简表的时候已经给了没有二意的注释,后期承接明确。

推荐教程:《Oracle视频教程》

以上就是oracle怎么增加列注释的详细内容,

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/sjk/949768.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-18
下一篇 2022-05-18

发表评论

登录后才能评论

评论列表(0条)

保存