我有几个值,和从1 auto_incremented主键的简单表:INSERT AUTO_INCREMENT值
create table test1 (acounter int not null primary key, studentid int not null,
ranking int not null, aweek date not null);
alter table test1 auto_increment=1;
如果我能我能INSERT INTO test1 (NULL,1012,1,'2015-04-20')
,但数据是在一个不同的顺序,以便我试过INSERT INTO test1 (acounter,aweek,ranking,studentid) VALUES (NULL,'2015-04-20',1,1012)
- 收到主键不能为NULL的错误。我不希望它是 - 我期待auto_increment使用下一个值。
不要在语句中提供自动增量字段名称或值。假装它不在那里,数据库会照顾它。 –
你不想插入自动增量值 – Cherry
INSERT INTO test1(aweek,ranking,studentid)VALUES('2015-04-20',1,1012) – Cherry