Skip to content
Advertisement

increment value in mysql after the table has been created

I would like to change the value in the second column to increment and also change the current NULL values to start using that incrementing system that begins at a value other than 1. I do see I can use

to change the table to start incrementing at the number I want it to but the values them selves are still null how do I change my table from this:

to this

How would I make the change if the table is in the hundreds of rows? Thanks

Advertisement

Answer

how about if you leave Id as auto-increment, drop the OtherNumber column, and when you do a select, have OtherNumber be a derived column=Id+6

There, maybe some other Answers will come along. Others could be better.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement