MySQL annotation Method

Source: Internet
Author: User

MySQL server support# End of the row,-- The row endsAnd/* The middle of a row or multiple rows */Comment box:

Mysql> select 1 + 1; # This comment ends until the end of the row mysql> select 1 + 1; -- This annotation ends until the end of the row. mysql> select 1/* This is a comment in the middle of the row */+ 1; mysql> select 1 +/* This is a multi-line comment form */1;

Note:-- (Double-length partitioning)Note style requires at least one space after two long strokes!

Although the server understands the annotation syntax just described, the syntax analysis of the mysql client is/*...*/There are limits on the annotation method:

  • Single quotes and double quotes are used to mark the beginning of a referenced string, even in a comment. If the quotation marks in the comment are not paired with another one, the syntax analysis program will not consider the comment end. If you runMySQL, You will be confused, because the prompt fromMysql>Change'>Or">.
  • A semicolon is used to indicate the end of the current SQL statement and anything that follows it indicates the start of the next row.

Whether you are running in interactive modeMySQLOr put the command in a file, and thenMysql <some-FileTellMySQLRead its input. This restriction exists.

I think: it is best to use # To start a single line comment, instead of --, because there must be at least one space after the comment. Sometimes an error will occur if you forget to write it!

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.