Home > Database > Mysql Tutorial > How to add comments in MySQL code?

How to add comments in MySQL code?

王林
Release: 2023-08-31 11:05:02
forward
1524 people have browsed it

How to add comments in MySQL code?

We can add comments in MySQL with the help of the # symbol. Whenever we add # symbol before any sentence, the entire line is ignored by MySQL.

MySQL supports three types of comments -

1.With the help of # symbol

mysql> create table CommentDemo
   -> (
   -> id int   #Id is an integer type
   -> );
Query OK, 0 rows affected (0.65 sec
Copy after login

Above, we set the annotation to

#Id is an integer type
Copy after login

2. Use the -- symbol

mysql> create table CommentDemo2
   -> (
   -> id int -- id is an integer type
   -> );
Query OK, 0 rows affected (0.49 sec)
Copy after login

Above, we set the annotation to -

- id is an integer type
Copy after login

3. Use /* */ symbols

This is used for multi-line comments, the same as in the C or C language.

mysql> create table CommentDemo3
   -> (
   -> /*id is an integer type */
   -> id int
   -> );
Query OK, 0 rows affected (0.52 sec)
Copy after login

Above, we set the multi-line comment to

/*id is an integer type */
Copy after login

The above is the detailed content of How to add comments in MySQL code?. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
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