:I have this table:
id | name | chapter | book
1 hamlet I Hamlet
2 Ismael IV Moby Dick
The behaviour I expect for new values is:
Same name && same book => Character exists so Same id than the existing one:
2 Ismael X Moby Dick
Same name && different book => Character doesn't exist so Changes the id:
3 Ismael XX The Bible
My question is:
Do I have to make the query before insert new values and then insert the new value?
or there is a way to do it in a automatic way by setting up a trigger or something?
My CREATE TABLE statement
db.execSQL("CREATE TABLE characters (id INTEGER NOT NULL ,
name TEXT NOT NULL , chapter TEXT NOT NULL , book TEXT NOT NULL );");