MySQL allows you to intersperse comments with your SQL code. Comments can be useful for documenting statements that you store in files. This section describes how to write comments in your SQL statements.
The MySQL server understands three types of comments:
Comments are ignored by the server when executing statements, with the exception that C-style comments that begin with '/*!' are given special treatment. You can "hide" MySQL-specific keywords in C-style comments by beginning the comment with '/*!' rather than with '/*'. MySQL looks inside this special type of comment and uses the keywords, but other database servers will ignore them as part of the comment. This has a portability benefit, at least for other servers that understand C-style comments: It is possible to write code that takes advantage of MySQL-specific functions when executed by MySQL but that can be used with other database servers without modification. The following two statements are equivalent for database servers other than MySQL, but MySQL will perform an INSERT DELAYED operation for the second:
INSERT INTO mytbl (id,date) VALUES(13,'2004-09-28'); INSERT /*! DELAYED */ INTO mytbl (id,date) VALUES(13,'2004-09-28');
C-style comments can be made version-specific. Follow the opening '/*!' sequence with a five-digit version number and the server will ignore the comment unless it is at least as recent as the version named. The comment in the following CREATE TABLE statement is ignored unless the server is version 4.1.0 or later:
CREATE TABLE t (i INT, INDEX /*!40100 USING BTREE */ (i)) ENGINE = MEMORY;