Home  >  Article  >  Database  >  How to add comments in MySQL code?

How to add comments in MySQL code?

王林
王林forward
2023-08-31 11:05:021450browse

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

Above, we set the annotation to

#Id is an integer type

2. Use the -- symbol

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

Above, we set the annotation to -

- id is an integer type

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)

Above, we set the multi-line comment to

/*id is an integer type */

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!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete
Previous article:Add MySQL to Windows pathNext article:Add MySQL to Windows path