title: SQLiteDatabase: Insert only if the value does not exist (not via raw SQL command)
body: <p>I know there's an SQL command that goes like this: <code>IF NOT EXISTS</code>, but since Android's <code>SQLiteDatabase</code> class has some fine methods, I was wondering if it's possible to insert a value if it doesn't exist via a method.</p>
  
  <p>Currently I'm using this to insert a <code>String</code>:</p>
  
  <pre><code>public long insertString(String key, String value) {
      ContentValues initialValues = new ContentValues();
      initialValues.put(key, value);
      return db.insert(DATABASE_TABLE, null, initialValues);
  }
  </code></pre>
  
  <p>(<code>db</code> is an instance of <code>SQLiteDatabase</code>.)</p>
  
  <p>I tried the method <code>insertOrThrow()</code> instead of <code>insert()</code>, but it seems it does the same as <code>insert()</code>. That is, if the value is already in the row, it's inserted again so the row now has two values of the same value.</p>