国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數據庫 > Oracle > 正文

oracle comment命令用法示例分享

2020-07-26 14:22:08
字體:
來源:轉載
供稿:網友

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
------------------------------ ----------- ----------
EMPLOYEES                      TABLE       員工表

SQL> select * from user_tab_comments where comments is not null;

TABLE_NAME                     TABLE_TYPE  COMMENTS
------------------------------ ----------- --------------------------
EMPLOYEES                      TABLE       員工表

4.查看表中列的說明

復制代碼 代碼如下:

SQL> select * from user_col_comments where TABLE_NAME='EMPLOYEES';

復制代碼 代碼如下:

TABLE_NAME                     COLUMN_NAME                    COMMENTS
------------------------------ ------------------------------ ------------
EMPLOYEES                      EMPLOYEE_ID                   
EMPLOYEES                      MANAGER_ID                    
EMPLOYEES                      FIRST_NAME                    
EMPLOYEES                      LAST_NAME                     
EMPLOYEES                      TITLE                         
EMPLOYEES                      SALARY                         員工薪水


SQL> select * from user_col_comments where comments is not null;

TABLE_NAME                     COLUMN_NAME                    COMMENTS
------------------------------ ------------------------------ -------------
EMPLOYEES                      SALARY                         員工薪水

5.我們也可以從下面這些視圖中查看表級和列級說明:

復制代碼 代碼如下:

ALL_COL_COMMENTS
USER_COL_COMMENTS
ALL_TAB_COMMENTS
USER_TAB_COMMENTS

6.刪除表級說明,也就是將其置為空

復制代碼 代碼如下:

SQL> comment on table employees is '';
Comment added

SQL> select * from user_tab_comments where TABLE_NAME='EMPLOYEES';

TABLE_NAME                     TABLE_TYPE  COMMENTS
------------------------------ ----------- -------------
EMPLOYEES                      TABLE     

7.刪除列級說明,也是將其置為空

復制代碼 代碼如下:

SQL> comment on column employees.salary is '';
Comment added

SQL> select * from user_col_comments where TABLE_NAME='EMPLOYEES';

TABLE_NAME                     COLUMN_NAME                    COMMENTS
------------------------------ ------------------------------ -------------
EMPLOYEES                      EMPLOYEE_ID                   
EMPLOYEES                      MANAGER_ID                    
EMPLOYEES                      FIRST_NAME                    
EMPLOYEES                      LAST_NAME                     
EMPLOYEES                      TITLE                         
EMPLOYEES                      SALARY

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 类乌齐县| 丰县| 赤壁市| 合江县| 沁源县| 长治市| 云阳县| 腾冲县| 遂川县| 衡阳市| 芦山县| 蒙阴县| 新泰市| 邵东县| 铁岭县| 延庆县| 霍林郭勒市| 前郭尔| 越西县| 牙克石市| 沧源| 常熟市| 晋江市| 资阳市| 石嘴山市| 勃利县| 辽宁省| 赞皇县| 疏勒县| 阜城县| 古交市| 延长县| 安岳县| 陆丰市| 徐汇区| 博湖县| 孟村| 普洱| 馆陶县| 盘山县| 吉木萨尔县|