不寻常的SQL错误

als*_*eet 2 mysql sql

所以我一直坚持这个SQL错误.

这是我正在使用的SQL行:

INSERT INTO images (image_name, orientation, restored, commercial, automotive, bespoke, before, after, date_added) 
VALUES ('image4-after.jpg', 'portrait', '1', '1', '1', '1', '24', '5', '2012-07-08')
Run Code Online (Sandbox Code Playgroud)

使用这种结构:

image_id - int(11) AUTO_INCREMENT
image_name - varchar(40)
orientation - varchar(4)
restored - tinyint(1)
commercial - tinyint(1)
automotive - tinyint(1)
bespoke - tinyint(1)
before - int(11)
after - int(11)
date_added - date
Run Code Online (Sandbox Code Playgroud)

收到错误消息:

1064 - 您的SQL语法出错; 检查与MySQL服务器版本对应的手册,以便在'before,after,date_added'附近使用正确的语法VALUES('image4-after.jpg','portrait','1','1','1''在第1行

任何人都可以告诉我我做错了什么?

谢谢

Mic*_*ski 10

BEFOREMySQL保留的关键字.您需要使用反引号引用它以将其用作表或列标识符.

INSERT INTO images (image_name, orientation, restored, commercial, automotive, bespoke, `before`, after, date_added) 
VALUES ('image4-after.jpg', 'portrait', '1', '1', '1', '1', '24', '5', '2012-07-08')
Run Code Online (Sandbox Code Playgroud)

AFTER 但是,并没有保留.

每当1064错误指向其right syntax to use near...指示符中语法不明显的内容时,请查看保留字列表.