2013-03-07 102 views
0

我正在使用此代碼在數據庫中創建一個表。似乎是正確的,但我得到一個語法錯誤。我直接從http://dev.mysql.com/doc/refman/5.6/en/create-table.html使用語法,但沒有雪茄。想法?創建表返回錯誤1064語法錯誤

create table car (
VIN integer primary key autoincrement, 
make text not null, 
model text not null, 
year text not null); 
+0

啊。菜鳥的錯誤。謝謝,我已經太久了,我很感激。 – EGHDK 2013-03-07 04:21:14

+0

當您收到mysql語法錯誤時,請務必小心或閱讀消息的「使用附近...」部分;它會讓你指向正確的方向。 – 2013-03-07 04:35:34

回答

1

錯字:它auto_incrementautoincrement

0

你在自動增量語法中錯了。

使用此:

create table car (
VIN integer primary key auto_increment, 
make text not null, 
model text not null, 
year text not null); 

更多:AUTO_INCREMENT

0
create table car (
    VIN integer AUTO_INCREMENT PRIMARY KEY, 
    make text not null, 
    model text not null, 
    year text not null 
); 

應工作