为什么这个MySQL语句会抛出语法错误?

时间:2009-07-11 16:12:07

标签: mysql

SQL声明:

INSERT INTO order (`ORDER_ID`,`SALE_CODE`,`CREATED_AT`,`UPDATED_AT`) VALUES ('2646253286','HPHS20','2009-07-11 12:07:40','2009-07-11 12:07:40')

错误:

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_ID`,`SALE_CODE`,`CREATED_AT`,`UPDATED_AT`) VALUES ('2646253286','H' at line 1 

2 个答案:

答案 0 :(得分:5)

您有一个名为order的表,它是SQL中的保留字。我不确定如何在MySQL中解决它,但在SQL Server中它将类似于

insert into [order] ...

答案 1 :(得分:5)

修复反引号(`)以便解决此问题。