MySQL-এ `AUTO_INCREMENT` কলামের পরবর্তী মান পরিবর্তন করতে `ALTER TABLE ... AUTO_INCREMENT = value` ব্যবহার করুন। এটি ডেটা মাইগ্রেশন বা টেস্টিংয়ে খুব কাজে লাগে।
সিনট্যাক্স
ALTER TABLE yourTableName AUTO_INCREMENT = IntegerValue;
উদাহরণ
mysql> CREATE TABLE changeCurrentAutoIncrementValue (
-> CurrentCount INT AUTO_INCREMENT,
-> PRIMARY KEY(CurrentCount)
-> );
mysql> INSERT INTO changeCurrentAutoIncrementValue VALUES (), (), (), (); -- 1,2,3,4
mysql> ALTER TABLE changeCurrentAutoIncrementValue AUTO_INCREMENT = 300;
mysql> INSERT INTO changeCurrentAutoIncrementValue VALUES (), (), (); -- 300,301,302
mysql> SELECT * FROM changeCurrentAutoIncrementValue;
+--------------+
| CurrentCount |
+--------------+
| 1 |
| 2 |
| 3 |
| 4 |
| 300 |
| 301 |
| 302 |
+--------------+
সতর্কতা: `AUTO_INCREMENT` মান বর্তমান সর্বোচ্চ মানের চেয়ে কম সেট করলে ডুপ্লিকেট কি এরর হতে পারে। সর্বোচ্চ মানের চেয়ে বড় মান সেট করুন।