首頁  >  文章  >  資料庫  >  如何在MySQL程式碼中加入註解?

如何在MySQL程式碼中加入註解?

王林
王林轉載
2023-08-31 11:05:021450瀏覽

如何在MySQL程式碼中加入註解?

我們可以藉助#符號在MySQL中加入註解。每當我們在任何句子前面加上#符號時,整行都會被MySQL忽略。

MySQL支援三種類型的註解 -

1.借助#符號

mysql> create table CommentDemo
   -> (
   -> id int   #Id is an integer type
   -> );
Query OK, 0 rows affected (0.65 sec

上面,我們將註解設定為

#Id is an integer type

2.借助--符號

mysql> create table CommentDemo2
   -> (
   -> id int -- id is an integer type
   -> );
Query OK, 0 rows affected (0.49 sec)

在上面,我們將註解設定為 -

- id is an integer type

3.借助 /* */ 符號

這用於多行註釋,與 C 或 C 語言相同。

mysql> create table CommentDemo3
   -> (
   -> /*id is an integer type */
   -> id int
   -> );
Query OK, 0 rows affected (0.52 sec)

上面,我們將多行註解設定為

/*id is an integer type */

以上是如何在MySQL程式碼中加入註解?的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文轉載於:tutorialspoint.com。如有侵權,請聯絡admin@php.cn刪除