Home  >  Article  >  Database  >  How to comment multiple lines in mysql

How to comment multiple lines in mysql

WBOY
WBOYOriginal
2022-02-24 14:45:514629browse

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*/".

How to comment multiple lines in mysql

The operating environment of this tutorial: windows10 system, mysql8.0.22 version, Dell G3 computer.

How to comment multiple lines in mysql

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!

Statement:
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