2013-03-07 107 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 
); 

应工作