本教程操作环境: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怎么增加列注释的详细内容。