我們能否使用 MySQL 建立帶數字名稱的資料庫?


您無法建立如下所示的帶數字名稱的資料庫 −

mysql> create database 1233;

這會產生以下輸出 −

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 '1233' at line 1

要建立帶數字名稱的資料庫,您需要在資料庫名稱周圍使用反引號 −

create database yourDatabaseName;

讓我們實現上述語法 −

mysql> create database `1233`;
Query OK, 1 row affected (0.20 sec)

現在,您可以切換到同一個資料庫 −

mysql> use `1233`;
Database changed

更新於:2019-12-16

356 次瀏覽

啟動您的 職業

完成課程即可獲得認證

開始
廣告