I have a table in SQLite database of Android which has a column RANK. It is in a game application. If some user get a rank, then it’s rank should be inserted and the previously stored ranks should be incremented.
let RANK column has values 1 2 3 4 5 6 7 8 9 and a new user gets a RANK 3, then I have to insert the new user’s rank and increment the previous ranks. I mean 3 4 5 6 7 8 9 should be 4 5 6 7 8 9 10 and the newly created 3 RANK should be inserted.
Is there any library method to do this? or i have to define custom logic?
Please help me. If custom logic is needed, then at least give some hint.
Do this before inserting the new value, if 3 is the rank of the new value you’re going to insert:
Before:
After:
Then you can insert the new one:
Giving the final result: