tags:

views:

74

answers:

1

My table has only a single column calld id. This column is an autoincrementing key (I am using it for sequencing). I want to do something like: insert into sequencer; but this gives me SQL errors because I guess I need to have a values portion. But there are no other columns in the table and I want the id column to be autoincremented. I'd also rather not hack this by just adding another dummy column. Thanks.

+6  A: 
INSERT INTO table SET id = NULL;

or

INSERT INTO table VALUES (NULL);

When inserting NULL into an auto-increment column, mysql will generate a new number instead.

too much php
Yep, and MySQL's auto-increment also generates a new number when you try to insert zero.
Bill Karwin