title: INSERT with IF Exists in SQL, SQLite
body: <p>how to check the value exist before insert?</p>
  
  <pre><code>INSERT INTO DeliveryOrder (ContactName, ContactID) VALUES ('Andy', (SELECT ContactID FROM Contact WHERE ContactName = 'Andy')) 
  </code></pre>
  
  <p>I want to verify whether the ContactID is exist before insert the record.</p>
  
  <p>Had try below but not working:</p>
  
  <pre><code>INSERT INTO DeliveryOrder (ContactName, ContactID) VALUES ('Andy', (SELECT ContactID FROM Contact WHERE ContactName = 'Andy')) WHERE IF Exists (SELECT ContactID FROM Contact WHERE ContactName = 'Andy')
  </code></pre>