2013-02-16 103 views
0

表模式:您的SQL语法有错误; MySQL的

CREATE TABLE IF NOT EXISTS `movie` (
    `id` int(11) NOT NULL AUTO_INCREMENT, 
    `name` text NOT NULL, 
    `desc` text NOT NULL, 
    `review` text NOT NULL, 
    `image_url` text NOT NULL, 
    `promo_url` text NOT NULL, 
    `created_on` datetime NOT NULL, 
    `modified_on` datetime NOT NULL, 
    PRIMARY KEY (`id`) 
) 

Insert语句:

INSERT INTO movie (name, desc, review, image_url, promo_url, created_on, modified_on) VALUES ('?p0', '?p1', '?p2', '?p3', '?p4', '?p5', '?p6') 

错误:

#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 'desc, review, image_url, promo_url, created_on, modified_on) VALUES ('?p0', '?p1' at line 1 

我无法找出错误根源,任何人都可以请指出来?

回答

3

descreserved word。可以将其包装成刻度或将其更改为“描述”或任何其他非保留名称。

1

对我来说,代码的作品。也许“desc”会造成问题(尽管你用反引号)?

1

DESC是MySQL中的保留字。

不过,您仍然可以在表格定义中使用它。只是用反引号包起来:

(name, `desc`, ... 
相关问题