I am making a website and giving each user a unique id after registration. The unique id must start from 80001.But Now I want second user to have id 80002,third user 80003.Could this be possible in SQL because I only want to update last 3 digits only.I tried doing it via sequence but couldn't able to do it.
The way to do this is:
ALTER TABLE tbl AUTO_INCREMENT = 80000;
I think you have a bad plan though. For one thing, if you have multiple key fields then use multiple fields for them because that will work much faster. Secondly, you could never have more than 999 users on your site using this before it'll break. Third, noone else is going to have any idea of what you are doing. This will be hard to maintain. Three good reasons should be enough to change your mind.
Update
To alter the auto increment table:
ALTER tbl MODIFY `rowid` int(11) NOT NULL AUTO_INCREMENT;
To update the table:
UPDATE tbl SET `rowid` = `rowid`-80000;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With