title: SQLite - update (not replace) if exists, else insert
body: <p>I'm trying to insert data into an sqlite db which may already exist. If it exists, I want to add to it (NOT replace!). I'm not really sure how to do this.</p>
  
  <p>something like this (not sure if my syntax is right)</p>
  
  <pre><code>
  case
    when exists(select * from Link where word1='%s' and word2='%s')
      then update Link set n = %d + (select n from Link where word1='%s' and word2='%s')
    else
      insert into Link values('%s', '%s', %d)
  </code></pre>