Brief introduction of MySQL statement annotation mode

  • 2021-09-11 21:40:10
  • OfStack

MySQL supports three annotation modes:

1. From the '#' character from the end of the line.

2. From the '--' sequence to the end of the line. Note that the '--' (double dash) annotation style requires that the second dash be followed by at least one space character (such as space, tab, line break, etc.).

3. From the /* sequence to the following */sequence. The ending sequence is not set in the same line, so this syntax allows comments to span multiple lines.

The following example shows three styles of annotations:


// In mysql How to write comment statements in 
mysql> SELECT 1+1;   #  This comment is made until the end of the line 

mysql> SELECT 1+1;   --  This comment is made until the end of the line 

mysql> SELECT 1 /*  This is 1 A comment in the middle of the line  */ + 1;
mysql> SELECT 1+
/*
 This is 1 A 
 The form of multi-line comments 
*/
1;

The above annotation syntax applies to how the mysqld server parses SQL statements. The mysql client also performs partial statement parsing before sending it to the server. (For example, it resolves to determine statement boundaries in multiple statement lines).

Summarize

This is all about this article's introduction to the way MySQL statements are annotated. Interested friends can refer to: MySQL optimization using connection (join) instead of subquery, MYSQL subquery and nested query optimization instance analysis, mysql in statement subquery efficiency slow optimization skills examples, etc. If there are shortcomings, welcome to leave a message, this site will reply to you in time and make corrections, hoping to help you.


Related articles: