檢視文章 mysql 表注釋和字段注釋

2021-07-07 01:58:28 字數 698 閱讀 7781

參考文件不太給力啊,表注釋和字段注釋的資料不全。

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 表注釋和字段注釋

參考文件不太給力啊,表注釋和字段注釋的資料不全。1 建立表的時候寫注釋 create table test1 field name int comment 欄位的注釋 comment 表的注釋 2 修改表的注釋 alter table test1 comment 修改後的表的注釋 3 修改欄位的注釋...

mysql 表注釋和字段注釋

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

MySQL 新增和檢視表注釋 字段注釋

建立表的時候寫注釋 create table student name varchar 20 comment 欄位的注釋 age int comment 欄位的注釋 comment 表的注釋 修改表的注釋 alter table student comment 修改後的表的注釋 修改欄位的注釋 al...