DelphiFAQ Home Search:
General :: Databases :: mysql
General information about mysql - how to get around the differences between version 3.33 an 4, how to do stuff that you think you need a nested query for etc.

Articles:

This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.

Featured Article

How to change the next value of an auto_increment field

Question:

I have a table where the primary key is an auto increment field. I just deleted the last 2 rows and when the next record will be created it will use the next higher number but I'd like to subtract 2 from the auto_increment value. How can I do this?

Answer:

Use the ALTER TABLE statement as shown below:

/* this makes the next record have 911 in the auto increment field: */
 alter table MYTABLE auto_increment=911;
 

Generated 8:00:53 on Aug 19, 2017