Home > Database > Mysql Tutorial > body text

How to comment multiple lines in mysql

WBOY
Release: 2022-02-24 14:45:51
Original
4676 people have browsed it

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:

/*
  第一行注释内容
  第二行注释内容
*/
Copy after login

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;
Copy after login

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;
Copy after login

Insert a multi-line comment in the SQL statement, as shown below:

SELECT DISTINCT product_id, purchase_price
/* 这条SELECT语句,  
    会从结果中删除重复行。*/ 
    FROM Product;
Copy after login

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!

Related labels:
source:php.cn
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