MySQL数据库中的人生见证 MySQL数据库使用教程

凤凰 2021-4-3 88 4/3

MySQL数据库中的人生见证 MySQL数据库使用教程

每一种语言都有自己的注释方式,代码量越多,代码注释的重要性也就越明显。一般情况下,注释可以出现在程序中的任何位置,用来向用户或程序员提示或解释程序的功能及作用。本文主要介绍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中的人生见证的详细内容,更多请关注本站其它相关文章!

- THE END -

凤凰

4月03日09:10

最后修改:2021年4月3日
0

非特殊说明,本博所有文章均为博主原创。