MySQL 表及字段注釋

2021-06-19 18:06:02 字數 666 閱讀 4561

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

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...

sql查詢資料庫注釋(表及表注釋,欄位及字段注釋)

1.要查詢資料庫下所有表名以及表注釋 查詢資料庫 mammothcode 所有表注釋 select table name,table comment from information schema.tables where table schema mammothcode 2.要查詢表字段的注釋 查...