字段注释:
创建表时增加
create table test(
id int primary key auto_increment comment '用户id' , -- 主键自增 auto_increment
p_name varchar(256) comment '用户id'
)
已建表增加字段注释
alter table test change column p_name p_name_new int comment '测试表id' ; -- 包含字段改名,改类型,改长度,改注释
alter table test1 modify column field_name int comment '修改后的字段注释';
查看表结构(包含注释)
show full columns from test; -- 表格形式展示
show create table test; -- 建表语句展示
select * from COLUMNS where TABLE_SCHEMA='数据库名' and TABLE_NAME='test' ; -- 在元数据中以表格形式查看,通用以及适合多表元数据查看
表注释comment:
创建表时增加
create table test(
id int primary key , -- 主键
p_name varchar(256)
)comment='表的注释';
已建表增加表注释
alter table test comment '修改后的表的注释';
mysql注释的增加与修改
最新推荐文章于 2024-07-20 16:33:27 发布