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


create table fina_indicator(
ts_code varchar(20) comment 'TS代碼',
ann_date date comment '公告日期',
end_date date comment '報告期',

.....

報錯信息: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 'ts_code varchar(20)comment'TS代碼', ann_datedatecomment'公告日期', end_dat' at line 1

在終端下進入mysql創建表時報錯

但在Mysql workbench里創建不報錯

引號應該有正確的寫法;

 

_____________

新問題:把表刪除后,重新生成時報錯。且已經按照正確的引號方式書寫。

原因:因為字段幾十個,所有在excel中拼接后粘貼,雖然看着沒問題,但空格間是帶有格式的。

解決辦法:將所有空格規整后才能建表。

將建表的語句貼入sublime中,選定所有語句,可以看到格式,然后再替換

下面的語句就可以直觀看到間隔是用tab鍵隔開的

_______________

參見下文:

 

 

https://www.jianshu.com/p/a0e6f1e1ac73

 

在MySQL命令行使用sql語句進行建表時,MySQL 報錯,遇到同一個問題,寫一篇博客來加深印象。
原SQL語句:

 
 

CREATE DATABASE 'xiaoyaoji' CHARACTER SET utf8;
咋一看沒有問題,但是運行起來就會曝出以下問題:
 
 

這個問題是語法上的錯誤,在MySQL中,為了區分MySQL的關鍵字與普通字符, MySQL引入了一個反引號。
在上述的sql語句中,數據庫名稱使用的是單引號而不是反引號,所以會就報了這個錯誤出來。修改后為:

 

CREATE DATABASE `xiaoyaoji` CHARACTER SET utf8;` 
 
 

在英文鍵盤輸入環境下,按圖示按鈕輸入反引號 `


 
 
 
 


免責聲明!

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



猜您在找 解決:[Err] 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 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 '11. set password for 'root'@'localhost' 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 '"id", php"> [Err] 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 ''

php Mysql語法錯誤之> 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' MySql 執行語句錯誤 Err] 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 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 'groups)VALUES('1','hh','hh@163.com','Boss')' at line 1 Django進行數據遷移時,報錯:(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 '(6) NOT NULL)' at line 1") SQL語句報錯:You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near SQL Error: 1064, SQLState: 42000 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version

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