I'm using SQLite to store an id, uuid, value and a caught value.
I create the table with this command:
CREATE TABLE IF NOT EXISTS statz_fish_caught
('id' INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
'uuid' TEXT NOT NULL,
'value' INTEGER NOT NULL,
'caught' TEXT NOT NULL);
I use this command to insert (or replace) rows:
INSERT OR REPLACE INTO statz_fish_caught (uuid,value,caught)
VALUES ('uuid comes here', a number here, 'a certain string').
Let's say you have this data in the table:
http://pasteboard.co/gofap3y.png
This data would imply that UUID1 caught a total of 9 (1+5+3) fishes. 1 of fish type 1, 5 of fish type 2 and 3 of fish type 3. UUID2 has only caught 10 fishes of fish type 1. Now let's imagine UUID1 catches a new fish type: fish type 4. The database should create a new row with an auto incremented value of id 5, with uuid as 'uuid1', value=1 and caught=fish type 4.
Now let's also imagine UUID catches another fish of fish type 3. The row of uuid1 with fish type 3 (it has id 3) should be updated to represent value 4, like this:
http://pasteboard.co/goBZatx.png
Is this possible, if yes, how?