搜索
查看: 1177|回复: 0

SQL_为表和列加注释

[复制链接]

153

主题

3

回帖

479

积分

中级会员

积分
479
发表于 2014-10-9 17:27:57 | 显示全部楼层 |阅读模式
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 added
SQL> 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 added
SQL> select comments from user_col_comments where table_name='DEPT' and column_name='DNAME';
COMMENTS
--------------------------------------------------------------------------------
scotts table mean column which name is depts name

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

本版积分规则

 
 
大数据行业交流
大数据行业交流
大数据求职招聘
大数据求职招聘
站长电话:
15010106923
微信联系:
hb-0310
站长邮箱:
ab12-120@163.com
大数据中国微信

QQ   

版权所有: Discuz! © 2001-2013 大数据.

GMT+8, 2024-5-3 23:49 , Processed in 0.074038 second(s), 24 queries .

快速回复 返回顶部 返回列表