MySQL error #1064 when creating table

I know there are a bunch of questions with this subject but I haven't found my mistake here. I've just started learning SQL.

My query:

CREATE TABLE IF NOT EXISTS `data` (
  `id` int(11) NOT NULL auto_increment,
  `quizid` int(11) NOT NULL default '0',
  `result` int(3) NOT NULL default '0',
  `IP` varchar(16) NOT NULL default '',
  `ts` timestamp(14) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB ;

Error:

#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 '(14) NOT NULL,
  PRIMARY KEY  (`id`)' at line 6

I know the answer must be easy to spot by the right eyes.

Upvotes: 1

Views: 70

Answers (2)

Joke_Sense10
Joke_Sense10

Reputation: 5412

timestamp accepts length but upto 6 precision numbers. But then you need not specify length for timestamp

Upvotes: 3

zerkms
zerkms

Reputation: 255155

timestamp does not accept length in CREATE TABLE clause

Upvotes: 4

Related Questions