- # 和--:
- 都是单行注释 ,-- 后面要加一个空格
- 一条语句如果分成多行写,每行后面都可以用# 和--;一条语句如果只写一行,则# 和--只能写在行末尾,不能写在行中间
- 单行注释建议用#
- /* 注释 */:
- 多行注释,可以注释多行
- 可以用于一行语句任意位置进行注释
- comment:
- 表中的字段或列的注释是用属性comment来添加
- 存储过程中可以comment特征来添加注释
- 实例:
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'); √