2

I have the following INSERT statement:

INSERT INTO mytable (id, name) VALUES (%s, %s)

Sometimes I will have the id, but other times I will not and just want the id to autoincrement. Is there a way to do this without writing two different statements, for example, a special value (such as is done for the time value NOW()) to designate to use the auto-incrementing value

Bill Karwin
  • 538,548
  • 86
  • 673
  • 828
David542
  • 104,438
  • 178
  • 489
  • 842

0 Answers0