title: Inserting values only if the record doesn't exist already
body: <p>am using sqlite3 database. I have inserted set of device_ids(unique) in a table called device, this is done when the table is empty. But when i try to insert the ids again which contains some new id's it is throwing error because of uniqueness.</p>
  
  <pre><code> device_all_id.each do |device_id|
  
       insert into device (Device_id) values ('#{device_id.first}') where  where Device_id &lt;&gt; '#{device_id.first}'
  
   end
  </code></pre>
  
  <p>So i want to check whether the record is already there before inserting device_ids, so i tried 'IF EXISTS' query but that too throwing as syntax error.</p>
  
  <p>could anyone please help me out of this..</p>