1. 程式人生 > >資料庫工作筆記005---You have an error in your SQL syntax; check the manual that corresponds to y

資料庫工作筆記005---You have an error in your SQL syntax; check the manual that corresponds to y

Query : select * from order LIMIT 0, 1000 Error Code : 1064 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 'order LIMIT 0, 1000' at line 1

今天在查詢資料的時候遇到這個錯誤,特別的鬱悶,感覺自己寫的sql語句沒有問題啊,但就是提示我的sql語法錯誤,

後來終於找到了原因 該錯誤一般出現在表名或欄位名設計的過程中出現了mysql關鍵字導致的。

如果你用了mysql中的關鍵字做欄位,當你查詢的時候可以用  `order` 來括起來,這個 ` 並不是單引號,

而是數字那一行鍵的最左邊的那個鍵,在英文狀態下的才為 ` ,

用它把關鍵字括起來就可以解決這個問題

--------------------- 本文來自 haha_66666 的CSDN 部落格 ,全文地址請點選:https://blog.csdn.net/haha_66666/article/details/78444457?utm_source=copy