首頁 >php教程 >php手册 >四种mysql注释实例

四种mysql注释实例

WBOY
WBOY原創
2016-06-01 09:45:141144瀏覽

mysql注释方法一:使用#

<code class="language-sql">mysql>
mysql> SELECT 1+1;     # This comment continues to the end of line
+-----+
| 1+1 |
+-----+
|   2 |
+-----+
1 row in set (0.00 sec)

mysql></code>

mysql注释方法二:使用--

<code class="language-sql">mysql>
mysql> SELECT 1+1;     -- This comment continues to the end of line
+-----+
| 1+1 |
+-----+
|   2 |
+-----+
1 row in set (0.00 sec)</code>

mysql注释方法三:使用/* */

<code class="language-sql">mysql>
mysql>
mysql> SELECT 1 /* this is an in-line comment */ + 1;
+---------+
| 1   + 1 |
+---------+
|       2 |
+---------+
1 row in set (0.00 sec)

mysql> SELECT 1+
    -> /*
   /*> this is a
   /*> multiple-line comment
   /*> */
    -> 1;
+-------+
| 1+

1 |
+-------+
|     2 |
+-------+
1 row in set (0.00 sec)

mysql></code>

mysql注释方法四:使用/*! */

<code class="language-sql">mysql>
mysql>
mysql> CREATE /*!32302 TEMPORARY */ TABLE t (a INT);
Query OK, 0 rows affected (0.02 sec)

mysql>
mysql> desc t;
+-------+---------+------+-----+---------+-------+
| Field | Type    | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| a     | int(11) | YES  |     | NULL    |       |
+-------+---------+------+-----+---------+-------+
1 row in set (0.00 sec)

mysql>
mysql>
mysql> drop table t;
Query OK, 0 rows affected (0.00 sec)

mysql></code>

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn