MySql注释的写法

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

  在mysql中主要有三种方式:

  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 ' 你的添加说明' 的内容

原文地址:https://www.cnblogs.com/songtianfa/p/11417603.html