Friday, July 16, 2010

Insert value in auto increment column

How to insert automatically values in NOT NULL auto_increment and PRIMARY KEY column.

Suppose you have listed below table:

CREATE TABLE `testtest` (
  `id` bigint(20) NOT NULL auto_increment,
  PRIMARY KEY  (`id`)
) ; 
This table have only one column "id", and this column have attribute of  NOT NULL auto_increment and PRIMARY KEY.


you need to use listed below sql :

insert into testtest values(null)

OR

insert into testtest values('')

No comments:

Post a Comment