I have a table with an auto_increment field and sometimes rows get deleted so auto_increment leaves gaps. Is there any way to avoid this or if not, at the very least, how to write an SQL query that:
- Alters the
auto_increment
value to be the max(current value) + 1 - Return the new
auto_increment
value?
I know how to write part 1 and 2 but can I put them in the same query?
If that is not possible:
How do I "select" (return) the auto_increment
value or auto_increment
value + 1?