开发者

insertion only in table with one auto_increment column

is possible make insert in the table with only one column and this column is primary and auto_increment. 开发者_如何学Pythonexactly what I want is increase id by one and write it to table ... is it possible without select max value and increase it by one and than insert.. I think direct insert just increment value


The following statements will all cause an auto-increment column in MySQL to generate a new value:

INSERT INTO Foo (id) VALUES (0);
INSERT INTO Foo (id) VALUES (''); -- because the integer value of '' is zero
INSERT INTO Foo (id) VALUES (NULL);
INSERT INTO Foo (id) VALUES (DEFAULT);
INSERT INTO Foo () VALUES ();


Yes: INSERT INTO foo (id) VALUES ('')

This will add a new entry, and the id will auto-increment with 1 each time.
If this is useful is another question.. :-)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜