MySQL Comments

MySQL provides two types of comments: single-line comments and multi-line comments.

Single-line comments start with two dashes (–), and everything after the dashes on the same line is ignored by the MySQL parser. For example:

SELECT * FROM table_name -- This is a single-line comment
WHERE column_name = 'value';

In this example, the comment starts with -- and continues until the end of the line. The comment has no effect on the query itself and is ignored by MySQL.

Multi-line comments start with /* and end with */. Everything between these two delimiters is ignored by the MySQL parser. For example:

SELECT * FROM table_name /* This is a multi-line comment
that spans multiple lines */
WHERE column_name = 'value';

In this example, the comment starts with /* and ends with */. Everything between these delimiters is ignored by MySQL.

Comments are useful for documenting your code and providing context for others who may read or modify your code in the future. They can also be used to temporarily disable parts of a query for testing purposes.

Wordpress Social Share Plugin powered by Ultimatelysocial
Wordpress Social Share Plugin powered by Ultimatelysocial