Home > Database > Mysql Tutorial > body text

How many ways are there to write mysql comments?

青灯夜游
Release: 2020-10-06 08:22:49
Original
7164 people have browsed it

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 |
+-------+

-- (#后面直接根的就是注释)
Copy after login

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 |
+-----+

-- 注意啊-- 后面是要有一个空格的
Copy after login

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)
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template