檢視文章 mysql:表註釋和欄位註釋
阿新 • • 發佈:2018-12-17
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