2012-10-18 117 views
0

您好我想获得更多的familiat SQL和我使用MySQL来测试我的SQL queries.I似乎这个说法要得到一个sintax错误:语法错误创建表

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; 

错误:

#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

我在做什么错在这里?

+0

删除'(11)一种高精度'从你的查询只是使用'ID int NOT NULL auto_increment,' –

+2

更改:时间戳(14) - >时间戳 – Devart

+0

我希望它应该是一个警告声明它不是错误:) – gks

回答

4

尝试提这样

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; 
2

'TIMESTAMP(14)'已弃用;使用 'TIMESTAMP',而不是

1

试试这个:

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语句与字段声明