I am using mysql. I have a database table with auto_increment counter set. Now because of a requirement I need to leave starting 100 ids free and move all existing records starting from 101, so current id 1 will go to 101 and id 2 will become 102 and so on.
I am able to move records to 101 but the problem is that how to change auto_increment counter to max(id)+1.
Main constraint here with me is that I need to do it in single sql statement. I can not save the value using @counter and use it later.
I tried using below query
ALTER TABLE role AUTO_INCREMENT = (SELECT rd.counter FROM (SELECT (MAX(id) + 1) AS counter FROM role r) rd);
But it is not working.