Is it possible to modify the value (index) created by AUTO_INCREMENT?
as in title - Is it possible to modify the value (index) created by AUTO_INCREMENT?
Thank you,
Adam
Hi Adam!
Thanks for reaching out.
In MySQL, the syntax to change the starting value for an AUTO_INCREMENT column using the ALTER TABLE statement is:
ALTER TABLE table_name AUTO_INCREMENT = start_value;
Hope this helps.
Best,
Tsvetelin
Hi Tsvetelin,
I was more thinking about using DELETE statement. As I understand using DELETE does not reset the AUTO_INCREMENT - so:
1. If I delete the last record (let's assume its ID=100) - will the next inserted ID have the number 100 or 101(and there will be a gap betweem 99 and 101)?
2. What if we have 100 records and I delete the one with ID=7. Will SQL fill the ID gap and use this "free" ID=7 or will it use ID=101 for the next record?
Thank you,
Adam