共計 1080 個字符,預(yù)計需要花費 3 分鐘才能閱讀完成。
自動寫代碼機器人,免費開通
這篇文章主要介紹 navicat 如何顯示字段注釋,文中介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們一定要看完!
在 MySQL 數(shù)據(jù)庫中,字段或列的注釋是用屬性 comment 來添加。
創(chuàng)建新表的腳本中,可在字段定義腳本中添加 comment 屬性來添加注釋。
示例代碼如下:
create table test(id int not null default 0 comment ‘用戶 id’)
如果是已經(jīng)建好的表,也可以用修改字段的命令,然后加上 comment 屬性定義,就可以添加上注釋了。
示例代碼如下:
alter table test
change column id id int not null default 0 comment ‘測試表 id’
查看已有表的所有字段的注釋呢?
可以用命令:
show full columns from table;
示例如下:
show full columns from test;
1、創(chuàng)建表的時候?qū)懽⑨?
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;
–在元數(shù)據(jù)的表里面看
use information_schema;
select * from TABLES where TABLE_SCHEMA=‘my_db’ and TABLE_NAME=‘test1’ \G
5、查看字段注釋的方法
–show
show full columns from test1;
–在元數(shù)據(jù)的表里面看
select * from COLUMNS where TABLE_SCHEMA=‘my_db’ and TABLE_NAME=‘test1’ \G
在使用工具 Navicat 時,能更方便添加注釋。
右鍵選擇需要加注釋的表格,對象信息中的 DDL 下可以看到注釋 COMMENT。
右鍵選擇“設(shè)計表”,在下方就能看到注釋,點擊“添加”即可。
以上是“navicat 如何顯示字段注釋”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對大家有幫助,更多相關(guān)知識,歡迎關(guān)注丸趣 TV 行業(yè)資訊頻道!
向 AI 問一下細(xì)節(jié)