Home  >  Article  >  Database  >  How many ways are there to write mysql comments?

How many ways are there to write mysql comments?

青灯夜游
青灯夜游Original
2020-10-06 08:20:577163browse

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.

How many ways are there to write mysql 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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn