zoukankan      html  css  js  c++  java
  • 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 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

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

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

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

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

  • 相关阅读:
    Elasticsearch常用插件集合(转)
    istio 安装与bookinfo示例运行(转)
    kubernetes发布tomcat服务,通过deployment,service布署(转)
    记一次ceph集群的严重故障 (转)
    Linux centos 7 安装NFS服务
    Centos7下使用Ceph-deploy快速部署Ceph分布式存储-操作记录(转)
    docker 安装 jmeter
    idea 2018.1破解激活方法,有效期至2099年
    MySQL和Oracle的区别
    SpringCloud面试题
  • 原文地址:https://www.cnblogs.com/tlnshuju/p/7210374.html
Copyright © 2011-2022 走看看