mysql新增表注釋 字段注釋 檢視與修改注釋

2021-08-02 15:50:11 字數 657 閱讀 9737

1 建立表的時候寫注釋

create table test1

(field_name int comment '欄位的注釋'

)comment='表的注釋';

2 修改表的注釋

alter table test1 comment '修改後的表的注釋';

3 修改欄位的注釋

alter table test1 modify column field_name int comment '修改後的字段注釋';

--注意:欄位名和字段型別照寫就行

4 檢視表注釋的方法

--在生成的sql語句中看

show create table test1;

--在元資料的表裡面看

use information_schema;

select * from tables where table_schema='my_db' and table_name='test1' \g

5 檢視字段注釋的方法

--show

show full columns from test1;

--在元資料的表裡面看

select * from columns where table_schema='my_db' and table_name='test1' \g

sql server 新增表注釋 字段注釋

為字段新增注釋 格式如右 execute sp addextendedproperty ms description 字段備註資訊 user dbo table 字段所屬的表名 column 新增注釋的欄位名 execute sp addextendedproperty ms description...

mysql 獲取表注釋 字段注釋

表注釋儲存在information schema.tables表內 show table status 獲取當前庫下的所有表資訊 包括注釋 select table comment from information schema.tables同上 字段注釋儲存在information schema....

mysql 表注釋和字段注釋

1 建立表的時候寫注釋 create table test1 field name int comment 欄位的注釋 comment 表的注釋 2 修改表的注釋 alter table test1 comment 修改後的表的注釋 3 修改欄位的注釋 alter table test1 modif...