title: INSERT OR REPLACE only works with 1 row in database
body: <p>INSERT OR REPLACE works when there is only one row in the table and it happens to be the one that is replaced. However, when there are multiple rows in the table, INSERT OR REPLACE just inserts and creates a duplicate!</p>
  <p>For example, if I create an entry with eventId = '123'. And then try to write another entry with eventId = '123' and roomnumber equal to something different than the first entry, INSERT OR REPLACE will work. However, if there are more than one rows in the table it will create a duplicate. Here is my code:</p>
  <pre><code>String createSql = &quot;CREATE TABLE IF NOT EXISTS events (\n&quot;
              + &quot; eventId VARCHAR(20) PRIMARY KEY ON CONFLICT REPLACE,\n&quot;
              + &quot; roomNumber VARCHAR(20) NOT NULL,\n&quot;
              + &quot; startTime TIMESTAMP NOT NULL,\n&quot;
              + &quot; endTime TIMESTAMP NOT NULL,\n&quot;
              + &quot; name VARCHAR(250),\n&quot;
              + &quot; isVIP BOOLEAN NOT NULL,\n&quot;
              + &quot; capacity INTEGER(20) NOT NULL, \n&quot;
              + &quot; UNIQUE (eventId) \n&quot;
              + &quot;);&quot;;
  
  String sql = &quot;INSERT OR REPLACE INTO events (eventId, roomNumber, startTime, endTime, capacity, name, isVIP)&quot; + &quot; Values('&quot;+event.getID()+&quot;', '&quot;+event.getRoomNumber()+&quot;', '&quot;+event.getStartTime()+&quot;', '&quot;+event.getEndTime()+&quot;', '&quot;+event.getCapacity()+&quot;', '&quot;+event.getName()+&quot;', '&quot;+event.getVIPStatus()+&quot;')&quot;;
  </code></pre>