每一种语言都有自己的注释方式,代码量越多,代码注释的重要性也就越明显。一般情况下,注释可以出现在程序中的任何位置,用来向用户或程序员提示或解释程序的功能及作用。本文主要介绍MySQL
中的注释。
1.字段注释
create table test1( id int primary key comment 'user_id');
2.表注释
create table test2(id int primary key,name varchar(20) not null)comment='table_comment';
3.单行注释
a) 单行注释可以使用#
注释符,#
注释符后直接加注释内容。格式如下:
create table test3(id int primary key,name varchar(20) not null#偶只是一个单行属性);
b) 单行注释可以使用--
注释符,--
注释符后需要加一个空格,注释才能生效。格式如下:
create table test4(id int primary key,name varchar(20) not null -- 偶是一个--的单行属性school varchar(20) not null --偶是一个--的单行属性(错误的注释,因为--后面没有空一格));
4.多行注释
create table test5(id int primary key,name varchar(30) not null/*鲲之大,不知其几千里也,一锅炖不下,故有天眼*/ );
推荐:《mysql教程》
以上就是MySQL中的人生见证的知识。速戳>>知识兔学习精品课!