How to comment _ Mysql in MySQL statements

Source: Internet
Author: User
How to annotate statements in Mysql server supports three annotation styles:

· Start from the end of the line with the '#' character.

· From the '--' sequence to the end of the row. Note that the comment style of '--' must be followed by at least one space character (such as space, tab, line break, and so on ). This syntax is slightly different from the standard SQL comment syntax, which will be discussed in 1.8.5.7, "'--' as the comment start mark.

· From/*. The end sequence is not necessarily in the same row. Therefore, this syntax allows annotations to span multiple rows.

The following example shows three styles of annotations:

mysql> SELECT 1+1;     # This comment continues to the end of line
mysql> SELECT 1+1;     -- This comment continues to the end of line
mysql> SELECT 1 /* this is an in-line comment */ + 1;
mysql> SELECT 1+
/*
this is a
multiple-line comment
*/
1;

The preceding annotation syntax appliesMysqldHow does the server analyze SQL statements. Before sending it to the server,Mysql customersThe program also executes partial statement parsing. (For example, it determines the statement boundary in multiple statement lines through parsing ).

In MySQL 5.1,MysqlThe only limitation of parsing/*... */annotation is that the exclamation point used in conjunction with the style of annotation delimiters marks the SQL statement section with conditional execution. Suitable for interactive runningMysqlAnd put the Command into a file, and use it in batch modeMysqlTo processMysql <File_name. For more information and examples, see section 1.8.4, "MySQL extension to standard SQL ".

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.