Nimmagadda Gowtham
Nimmagadda Gowtham

Reputation: 270

How to add a value to integer and Update the value in SQLite Database Android

I'm trying to prepare an android app.

I have an column in SQLite Database with type as integer.

For Example the value of the integer in Database is 10. Now i want to update the value of that integer to by adding another value i have say 5.

So finally i want to update the integer value in Database to 15.

Which is the better solution to update the integer value in Database among below options

i) Get the Integer value from Database say 10, then add the value i have say 5 and update that integer value in Database.

ii) Is there any way to add value i have say 5 directly to integer value in Database say 10

Thank You in advance

Upvotes: 0

Views: 1834

Answers (1)

ehehhh
ehehhh

Reputation: 1074

Try something like this:

UPDATE table SET value = value + 5 WHERE id = 1;

Upvotes: 2

Related Questions