在建立 MySQL 表格時,使用保留關鍵字“鍵”
若想使用保留關鍵字“鍵”,可採用反引號符號。在此,我以 key 為例,在該列名的周圍加上反引號。
我們先來建立一張表 −
mysql> create table DemoTable ( `Key` int ); Query OK, 0 rows affected (0.67 sec)
使用 Insert 命令向表中插入一些記錄 −
mysql> insert into DemoTable values(100); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable values(101); Query OK, 1 row affected (0.55 sec) mysql> insert into DemoTable values(110); Query OK, 1 row affected (0.28 sec) mysql> insert into DemoTable values(120); Query OK, 1 row affected (0.09 sec)
使用 Select 語句顯示錶中的所有記錄 −
mysql> select *from DemoTable;
該操作會產生以下輸出 −
+------+ | Key | +------+ | 100 | | 101 | | 110 | | 120 | +------+ 4 rows in set (0.00 sec)
廣告
資料結構
網路
關係型資料庫管理系統
作業系統
Java
iOS
HTML
CSS
Android
Python
C 語言
C++
C#
MongoDB
MySQL
Javascript
PHP