title: How can I do 'insert if not exists' in MySQL?
body: <p>I started by googling and found the article <em><a href="http://www.xaprb.com/blog/2005/09/25/insert-if-not-exists-queries-in-mysql/" rel="noreferrer">How to write INSERT if NOT EXISTS queries in standard SQL</a></em> which talks about mutex tables.</p>
  <p>I have a table with ~14 million records. If I want to add more data in the same format, is there a way to ensure the record I want to insert does not already exist without using a pair of queries (i.e., one query to check and one to insert is the result set is empty)?</p>
  <p>Does a <code>unique</code> constraint on a field guarantee the <code>insert</code> will fail if it's already there?</p>
  <p>It seems that with <em>merely</em> a constraint, when I issue the insert via PHP, the script croaks.</p>