简体   繁体   English

INSERT INTO 语法错误 SQL

[英]INSERT INTO syntax error SQL

I am at a loss why I am getting this error.我不知道为什么我会收到这个错误。 It might something I can't see in my syntax so any help would be greatly appreciated.这可能是我在语法中看不到的东西,因此将不胜感激。

STATEMENT陈述

INSERT INTO pwd_review (id, request_date, being_reviewed, review_explain, 
                        attached_docs, doc_explain, age_met, age_explain, 
                        years_met, years_explain, severity, severity_explain, 
                        restriction, restriction_explain, require, require_explain) 
VALUES(410, DATE '2009-12-10', 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0,
       'Dr M Beaulieu has provided further information indicating that applicant is severly ill and disabled. Applican''t condition is confirmed as rectal adenocarcinoma, she has endured dhemo and readiation therapy and is under care of the Oncology Team, surgeon and GP.', 0,
       'Information from Dr states that applicant is unable to sit, has great difficulty walking and requires ongoing support from the Community Support Services',
       0, NULL);

ERROR错误

1064 - You have an error in your SQL syntax; 1064 - 您的 SQL 语法有错误; check the manual检查手册

that corresponds to your MySQL server version for the right syntax to use near 'require,require_explain) VALUES(410,DATE '2009-12-10',0,NULL,0,NULL,0,NULL,0,NUL' at line 1 that corresponds to your MySQL server version for the right syntax to use near 'require,require_explain) VALUES(410,DATE '2009-12-10',0,NULL,0,NULL,0,NULL,0,NUL' at line 1

Thanks.谢谢。

REQUIRE is a reserved MySQL keyword . REQUIRE保留的 MySQL 关键字 You must enclose it in backquotes as:您必须将其括在反引号中,如下所示:

`require`

Also, it's worth pointing out that MySQL escapes single quotes with a backslash, not two single-quotes like SQL Server and Access.此外,值得指出的是 MySQL 使用反斜杠转义单引号,而不是像 SQL Server 和 Access 这样的两个单引号。 This phrase may become problematic if the above is your exact SQL statement and that single quote has not been escaped:如果上面是您的确切 SQL 语句并且该单引号未被转义,则此短语可能会出现问题:

Applican''t condition

it's because "require" is a keyword backtick it.这是因为“require”是一个关键字反引号它。

I copy-pasted your query to MySQL Workbench, and it seems that you are using reserved require keyword as a name of a table column, to fix that:我将您的查询复制粘贴到 MySQL Workbench,您似乎正在使用保留的require关键字作为表列的名称,以解决该问题:

INSERT INTO pwd_review (id, request_date, being_reviewed, review_explain, 
                        attached_docs, doc_explain, age_met, age_explain, 
                        years_met, years_explain, severity, severity_explain, 
                        restriction, restriction_explain, `require`, require_explain) 
VALUES(410, DATE '2009-12-10', 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0,
       'Dr M Beaulieu has provided further information indicating that applicant is severly ill and disabled. Applican''t condition is confirmed as rectal adenocarcinoma, she has endured dhemo and readiation therapy and is under care of the Oncology Team, surgeon and GP.', 0,
       'Information from Dr states that applicant is unable to sit, has great difficulty walking and requires ongoing support from the Community Support Services',
       0, NULL);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM