每一种语言都有它的注释方式,代码量少的时候还可以,随着代码量越来越多,代码注释的重要性也越发凸显。

  在mysql中主要有三种方式:

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。

  1、常用的方式,跟在css中那些注释一样 :/* 内容 */

/* alter table cs modify  s_age  varchar(20) not null default '' */

  2、两条横线,mysql中通用的方式,一般都用这个: -- 内容(最后一条横线后有空格)

-- alter table  cs  character set utf8

  3、 字段或列的注释是用属性comment来添加。

 1 create table cs(
 2 
 3      id int UNSIGNED not null primary key auto_increment  comment "排序",
 4 
 5      s_name varchar(30) not null default ''  comment "姓名",
 6 
 7      s_age  varchar(10) UNSIGNED not null default '' comment "年龄" 
 8 
 9 )
10 
11  engine=innodb  default charset=utf8;

  可在表的设计模式中 ,看到注释为你添加的 comment ' 你的添加说明' 的内容

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄