I have a database table with two columns:
CREATE TABLE Main(Id TEXT, Count INTEGER)
I'm currently using something like bellow code for adding a number to a column if it already exists :
query = SELECT * FROM Main WHERE Id=some_word LIMIT 1
if(query has some elements){
     UPDATE Main SET Count=query.count+word_count WHERE Id=some_word
}
else{
     INSERT INTO table_name SELECT some_word AS Id , word_Count AS Count 
     //some more UNION SELECT ...
}
How can I make those statements faster ?
 
     
     
    