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 ' 你的添加說明' 的內容


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM