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!