Jump to content

How can i insert into table with auto_increment column ?


Recommended Posts

It's a mysql table.

The first column is int(11) auto_increment not null primary key,

I want to insert data into that table without specifying the first column name.

What would be the sql query?

The firs column is col1 with auto_increment.The value for the first column would be automatically inserted.Is it?

 

insert into tablename(col2,col3)

values("a","b");

Print the actual query, none of this "col2" and "tablename" stuff.  Obviously your fake pseudo-query would work fine.

 

Do a SHOW CREATE TABLE on the table, post that here.

 

Do an INSERT on the table, post that here as well as the error.

 

-Dan

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.