MySQL給欄位添加註釋?

MySQL給欄位添加註釋?hfhat32872019-10-16 01:46:13

在MySQL資料庫中,欄位或列的註釋是用屬性comment來新增。建立新表的指令碼中,可在欄位定義指令碼中新增comment屬性來添加註釋。示例程式碼如下:create table test(id int not null default 0 comment ‘使用者id’)如果是已經建好的表,也可以用修改欄位的命令,然後加上comment屬性定義,就可以新增上註釋了。示例程式碼如下:alter table testchange column id id int not null default 0 comment ‘測試表id’ 給表的欄位或列添加註釋已經知道了,那麼如何來檢視已有表的所有欄位的註釋呢?可以用命令:show full columns from table 來檢視,示例如下:show full columns from test;