MySQL รองรับ 3 รูปแบบความคิดเห็น:
1. # Comment
ความคิดเห็นบรรทัดเดียว เริ่มด้วย # จนจบบรรทัด
2. -- Comment
ความคิดเห็นบรรทัดเดียว ต้องมีช่องว่างหรือ control character หลัง --
3. /* Comment */
ความคิดเห็นหลายบรรทัด เริ่ม /* จบ */ อาจข้ามหลายบรรทัดได้
ตัวอย่างทั้ง 3 รูปแบบ
mysql> Select NOW() #Single line comment continues to the end of line
-> ;
+---------------------+
| NOW() |
+---------------------+
| 2017-11-07 15:04:03 |
+---------------------+
1 row in set (0.00 sec)
mysql> Select NOW() -- Single line comment continues to the end of line
-> ;
+---------------------+
| NOW() |
+---------------------+
| 2017-11-07 15:04:17 |
+---------------------+
1 row in set (0.00 sec)
mysql> Select 1 /* in-line comment */ +1;
+-------+
| 1 +1 |
+-------+
| 2 |
+-------+
1 row in set (0.10 sec)
mysql> Select 1
-> /* this is a Multiple-line
/*> comment
/*> */
-> +1;
+-------+
| 1 +1 |
+-------+
| 2 |
+-------+
1 row in set (0.00 sec)