Every language has its own way of commenting. The more code there is, the more obvious the importance of code comments becomes. In general, comments can appear anywhere in the program to prompt or explain the function and function of the program to the user or programmer. This article mainly introduces comments in MySQL
.
1.Field comments
create table test1( id int primary key comment 'user_id' ) ;
2.Table comments
create table test2( id int primary key, name varchar(20) not null )comment='table_comment';
3. Single-line comments
a) Single-line comments can use the # comment character, followed by the
# comment character Add annotations directly. The format is as follows:
create table test3( id int primary key, name varchar(20) not null#偶只是一个单行属性 );
b) Single-line comments can use --
comment characters, needs to add a space
after the -- comment character, comment to take effect. The format is as follows:
create table test4( id int primary key, name varchar(20) not null -- 偶是一个--的单行属性 school varchar(20) not null --偶是一个--的单行属性(错误的注释,因为--后面没有空一格) );
4. Multi-line comments
create table test5( id int primary key, name varchar(30) not null/*鲲之大,不知其几千里也, 一锅炖不下,故有天眼*/ );
Recommendation: "mysql tutorial》
The above is the detailed content of Life testimony in MySQL. For more information, please follow other related articles on the PHP Chinese website!