我們可以使用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`;

現在您可以切換到相同的數據庫-

mysql> use `1233`; Database changed


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM