第二十节:MySQL中的注释

  1. # 和--:
    1. 都是单行注释 ,-- 后面要加一个空格
    2. 一条语句如果分成多行写,每行后面都可以用# 和--;一条语句如果只写一行,则# 和--只能写在行末尾,不能写在行中间
    3. 单行注释建议用#
  2. /* 注释 */:
    1. 多行注释,可以注释多行
    2. 可以用于一行语句任意位置进行注释
  3. comment:
    1. 表中的字段或列的注释是用属性comment来添加
    2. 存储过程中可以comment特征来添加注释
  4. 实例:
    create table tb_name -- this is a table
    (id int(11));  √
    create table tb_name0 -- this is a table (id int(11)); ×
    create table tb_name1  (id int(11)); #this is a table √
    create table tb_name2 /*this is a table*/ (id int(11));
    create table tb_name3  (id int(11) comment 'this is a table'); √

猜你喜欢

转载自www.cnblogs.com/WeiKing/p/12218657.html