There are three types of mysql comments, namely: 1. Single-line comments using "#comment content"; 2. Single-line comments using "-- comment content", "--" and comment content There must be spaces between; 3. Use "/* comment content*/" for multi-line comments.
MySQL generally has three comment styles. They are:
1. Single-line comments can use "# "
select 1 as cname; #this is a comment +-------+ | cname | +-------+ | 1 | +-------+ -- (#后面直接根的就是注释)
2. The second way to write a single-line comment is to use "-- "
Note that in this style "--[space]" is There is a space between "--" and the comment.
select 123; -- this is a comment +-----+ | 123 | +-----+ | 123 | +-----+ -- 注意啊-- 后面是要有一个空格的
3. Multi-line comments can be made with /**/
mysql> select 123; /* this is a comment */+-----+ | 123 | +-----+ | 123 | +-----+1 row in set (0.00 sec) mysql> select 1+ /* this is a comment */ 1;+-------+ | 1+ 1 | +-------+ | 2 | +-------+1 row in set (0.00 sec)
Recommended tutorial: mysql video tutorial
The above is the detailed content of How many ways are there to write mysql comments?. For more information, please follow other related articles on the PHP Chinese website!