Add a comment for MySQL

Source: Internet
Author: User
Tags expression mysql mysql database


3.7 Plus Notes
MySQL allows annotations to be used in SQL code. This is useful for describing the queries that are stored in the file. You can write comments in two ways. All content, beginning with "#" until the end of the line, is considered a comment. Another is a C-style annotation. That is, all content that ends with "*/" is considered a comment, starting with "/*". C-style annotations can span multiple lines, such as:

Since the MySQL3.23 edition, you Can "hide" mysql-specific keywords in C-style annotations, commenting with "/*!" Rather than start with "/*". MySQL looks inside this particular type of comment and uses these keywords, but the other database servers ignore these keywords as part of the comment. This helps you write code that uses MySQL-specific functionality when MySQL executes, and that code can be used for other database servers without modification. The following two statements are equivalent to a non-MySQL database server, but if it is a MySQL server, an insert delayed action is executed in the second statement:


Since MySQL3.23.3, in addition to the annotation style just described, you can start the annotation with two dashes and a space ("--"), and all content from these dashes to the end of the line is treated as a comment. Some databases start with a double dash as a comment. MySQL also allows this, but need to add a space to avoid confusion. For example, a statement with an expression such as 5--7 may be considered to contain a comment, but it is not possible to write an expression such as 5--7, so this is a useful exploration. However, this is just an exploration, preferably without the annotation of this style.



Related Article

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.