2012-10-18 43 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語句與字段聲明