In mysql, you can use the "/* */" comment character to make multi-line comments. "/*" is used at the beginning of the comment content, "*/" is used at the end of the comment content, and the content of the comment It can span multiple lines, and the syntax is "/*Multi-line comments*/".
The operating environment of this tutorial: windows10 system, mysql8.0.22 version, Dell G3 computer.
Use /* */ comment symbols for multi-line comments. /* is used for the beginning of the comment content, */ is used for the end of the comment content. The multi-line comment format is as follows:
/* 第一行注释内容 第二行注释内容 */
The comment content is written between /* and */ and can span multiple lines.
Usage examples of multi-line comments are as follows
/*这条SELECT语句, 会从结果中删除重复行*/ SELECT DISTINCT product_id, purchase_price FROM Product;
Any comment (single-line comment and multi-line comment) can be inserted into the SQL statement, and the comment can be placed anywhere in the SQL statement.
Insert a single-line comment in the SQL statement, as shown below:
SELECT DISTINCT product_id, purchase_price -- 从结果中删除重复行。 FROM Product; SELECT DISTINCT product_id, purchase_price #从结果中删除重复行。 FROM Product;
Insert a multi-line comment in the SQL statement, as shown below:
SELECT DISTINCT product_id, purchase_price /* 这条SELECT语句, 会从结果中删除重复行。*/ FROM Product;
Comments can be written in any SQL statements, and there is no limit on the number of comments in a SQL statement.
Recommended learning: mysql video tutorial
The above is the detailed content of How to comment multiple lines in mysql. For more information, please follow other related articles on the PHP Chinese website!