我正在尝试运行以下查询,但它给了我这个错误:
Error
SQL query:
/* Then insert some posts for testing: */ INSERT INTO posts( title, body, created )
VALUES (
’The title’, ’This IS the post body.’, NOW( )
);
MySQL said: Documentation
#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 'title’, ’This is the post body.’, NOW())' at line 3
这是代码,
/* First, create our posts table: */
CREATE TABLE posts (
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(50),
body TEXT,
created DATETIME DEFAULT NULL,
modified DATETIME DEFAULT NULL
);
/* Then insert some posts for testing: */
INSERT INTO posts (title,body,created)
VALUES (’The title’, ’This is the post body.’, NOW());
INSERT INTO posts (title,body,created)
VALUES (’A title once again’, ’And the post body follows.’, NOW());
INSERT INTO posts (title,body,created)
VALUES (’Title strikes back’, ’This is really exciting! Not.’, NOW());
您没有为字符串使用正确的撇号:
INSERT INTO posts( title, body, created )
VALUES (
'The title', 'This IS the post body.', NOW( )
);
您使用’
代替'
。我假设您使用某些文字处理器(例如Word,LibreOffice等)编辑了文件。只需使用普通的旧文本编辑器(如记事本,Vi等)即可。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句