SQL 为表和列加注释

               

***********************************************声明*********************************************************************** 

原创作品,出自 “深蓝的blog” 博客,欢迎转载,转载时请务必注明出处,否则追究版权法律责任。

深蓝的blog:http://blog.csdn.net/huangyanlong/article/details/39755221

****************************************************************************************************************************

1. 表级

(1)、对表进行注释:
SQL>comment on table <表名> is <'正文'>;
--小写格式
SQL>COMMENT ON TABLE <表名> IS <'正文'>;
--大写格式
(2)、查看表的注释:
SQL>select comments from user_tab_comments where table_name='表名';
--小写格式
SQL>SELECT COMMENTS FROM user_tab_comments  WHERE TABLE_NAME='表名';
--大写格式
(3)、样例

SQL> comment on table dept is 'scotts deptno table' ;Comment addedSQL> select comments from user_tab_comments where table_name='DEPT';COMMENTS--------------------------------------------------------------------------------scotts deptno table

2. 列级

(1)、对列进行注释:
SQL>comment on column <表名.列名> is '正文';
--小写格式
SQL>COMMENT ON COLUMN <表名.列名> IS '正文';
--大写格式
(2)、查看列的注释:
SQL>select comments from user_col_comments where table_name='表名' and column_name='列名';
--小写格式
SQL>SELECT COMMENTS FROM user_col_comments WHERE TABLE_NAME='表名' AND COLUNM_NAME='列名';
--大写格式
(3)、样例

SQL> comment on column dept.dname is ' scotts table mean column which name is depts name ';Comment addedSQL> select comments from user_col_comments where table_name='DEPT' and column_name='DNAME';COMMENTS-------------------------------------------------------------------------------- scotts table mean column which name is depts name

***********************************************声明*********************************************************************** 

原创作品,出自 “深蓝的blog” 博客,欢迎转载,转载时请务必注明出处,否则追究版权法律责任。

深蓝的blog:http://blog.csdn.net/huangyanlong/article/details/39755221

****************************************************************************************************************************

           

再分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://blog.csdn.net/jiangjunshow

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值