As the link you provided clearly explain it --
is the standard SQL "comment separator". Where MySQL departs from standard is in requiring an space after --
to be recognized as a comment. "Standard" SQL does not require this.
To provide an example, in the following code, --
is recognized as a comment token:
mysql> CREATE TABLE T(C int); -- This is my new table
Query OK, 0 rows affected (0.18 sec)
But notice how the interactive interpreter misbehave without space after --
:
mysql> CREATE TABLE T(C int); --This is my new table
Query OK, 0 rows affected (0.24 sec)
-> ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '--This is my new table' at line 1
MySQL support some other comment format to accommodate with habit of various programmers : #
like many script language and /* ... */
like C. It is quite astounding that //
is not yet part of them.
mysql> CREATE TABLE T(C int); /* This is my new table */
Query OK, 0 rows affected (0.22 sec)
mysql> CREATE TABLE T(C int); # This is my new table
Query OK, 0 rows affected (0.24 sec)