MySQL字段添加注释有两种方式

问:MySQL如何给字段添加注释?

答:给MySQL字段添加注释有两种方式

① 创建表的时候添加

create table student(
  s_no int not null comment '学号',
  s_name varchar(100) comment '姓名'
) comment = '学生'

如上面的创建表语句,字段 s_nos_name 后面通过关键字 comment 来给对应的字段添加注释。

comment 关键字后面用单引号括起来的就是你需要给这个字段添加的注释。

② 当你已经创建好表了,但是发现忘记注释或者注释的内容需要改变的时候,你可以通过以下命令去更改 student 表的 s_name 字段的注释

alter table student modify s_name varchar(100) comment '姓名-更改';




mysql 存储过程 参考: https://www.cnblogs.com/mark-chan/p/5384139.html

m
ysql 递归实现 参考 : https://blog.csdn.net/lilizhou2008/article/details/108505353 https://www.cnblogs.com/longlongogo/p/10815723.html
posted @ 2022-03-17 15:21  Samuel-Leung  阅读(2006)  评论(0编辑  收藏  举报