is possible make insert in the table with only one column and this column is primary and auto_increment. exactly 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
+2
A:
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.. :-)
Alec
2010-10-04 17:40:56
+1
A:
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 ();
Bill Karwin
2010-10-04 18:08:50