0

I am triing the blog tutorial from the cookbook

CREATE TABLE posts (
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(50),
body TEXT,
created DATETIME DEFAULT NULL,
modified DATETIME DEFAULT NULL
);

But when I insert the values that he gave me

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());

I get this error message

#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 2 
Robert
  • 10,403
  • 14
  • 67
  • 117
MahmoudSenSei
  • 13
  • 1
  • 3

1 Answers1

1

The correct format is

INSERT INTO posts 
(
title,body,created
)
VALUES 
(
'The title', 'This is the post body.', NOW()
);

http://sqlfiddle.com/#!2/2796d

Abhik Chakraborty
  • 44,654
  • 6
  • 52
  • 63