mysql 表名不加单引号_当表名“ match”没有用单引号引起来时,MySQL引发错误?...
不要使用單引號。您需要在表名匹配周圍使用反引號,因為它是MySQL中的保留名。以下是發生的錯誤:mysql>?select?*from?match;
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?'match'?at?line?1
我們首先創建一個表,并使用保留字匹配周圍的反引號來修復上述錯誤的發生,此處用作表名-mysql>?create?table?`match`
(
Id?int?NOT?NULL?AUTO_INCREMENT?PRIMARY?KEY,
PlayerName?varchar(20)
);
使用insert命令在表中插入一些記錄?,F在,無論在哪里使用保留字,都用反引號包圍-mysql>?insert?into?`match`(PlayerName)?values('Chris');
mysql>?insert?into?`match`(PlayerName)?values('Bob');
mysql>?insert?into?`match`(PlayerName)?values('David');
mysql>?insert?into?`match`(PlayerName)?values('Mike');
mysql>?insert?into?`match`(PlayerName)?values('Sam');
使用select語句顯示表中的所有記錄-mysql>?select?*from?`match`;
這將產生以下輸出-+----+------------+
|?Id?|?PlayerName?|
+----+------------+
|??1?|?Chris??????|
|??2?|?Bob????????|
|??3?|?David??????|
|??4?|?Mike???????|
|??5?|?Sam????????|
+----+------------+
5?rows?in?set?(0.00?sec)
總結
以上是生活随笔為你收集整理的mysql 表名不加单引号_当表名“ match”没有用单引号引起来时,MySQL引发错误?...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: jquery拼接后css样式不生效_JQ
- 下一篇: mysql显示bmp图片_BMP格式图像