Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What's the correct SQL syntax for...

Status
Not open for further replies.

webIntern

Programmer
Nov 22, 2002
40
US
inserting a new record with an auto-increment field??
 
Assume:

Code:
create table foo
(
  ID int unsigned auto_increment primary key,
  name varchar(10)
)


Either of:
Code:
INSERT INTO foo (name) values ('foo')

INSERT INTO foo (ID, name) values (NULL, 'foo')

Would insert the value and cause MySQL to set the ID column to the auto_increment.

Want the best answers? Ask the best questions: TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top