Reputation: 5393
Hi I am trying to get more familiat with SQL and I am using MySql to test my SQL queries.I seem to be getting a sintax error in this statement:
CREATE TABLE dog
(
id int(11) NOT NULL auto_increment,
name varchar(255),
descr text,
size enum('small','medium','large'),
date timestamp(14),
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), PRIMARY KEY (id) )ENGINE = InnoDB' at line 7
What am I doing wrong here?
Upvotes: 0
Views: 5359
Reputation: 510
Try this :
CREATE TABLE dog
(
id int NOT NULL auto_increment PRIMARY KEY,
name varchar(255),
descr text,
size enum('small','medium','large'),
date timestamp
)
ENGINE = InnoDB;
PRIMARY KEY statement has to be precised with the field declaration
Upvotes: 1
Reputation: 180
try mentioning like this
CREATE TABLE dog
(
id int NOT NULL auto_increment,
name varchar(255),
descr text,
size enum('small','medium','large'),
date timestamp,
PRIMARY KEY (id)
)
ENGINE = InnoDB;
Upvotes: 4