Say, on a mysql database, there’s a table
example_table
that contains a field
example_id
of type
auto_increment
and for some reason, one wants the next value of the auto_increment to be a specific value (x ≥ 0), then, they can do the following in a mysql session:
alter table example_table auto_increment x;
If the above table is not void of data and the current value of the auto_increment is y, one can run the above code, for any x > y only, otherwise an error is produced.
NOTE, if a table has been emptied with the truncate statement, then the auto_increment is reset to the value 1.