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删除。



猜您在找 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 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") 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", 解决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 (order_name, customer) mybatis批量更新update-设置多个字段值 报错 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 插入数据库失败([Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version) check the manual that corresponds to your MySQL server version for the right syntax to use near 'IDENTIFIED BY '123456' WITH GRANT OPTION' at line 1 Error Code : 1064 You have an error in your SQL syntax; check the manual that corresponds to your My pymysql 1064, 'You have an error in your SQL syntax; check the manual that corresponds to
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM