title: How to use ON DUPLICATE KEY UPDATE in MySQL without a UNIQUE index or PRIMARY KEY?
body: <p>The MySQL manual states:</p>
  
  <blockquote>
    <p>If you specify ON DUPLICATE KEY UPDATE, and a row is inserted that
    would cause a duplicate value in a UNIQUE index or PRIMARY KEY</p>
  </blockquote>
  
  <p>What if you have a table that does not have a UNIQUE index or PRIMARY KEY, but you don't want to duplicate an entry for a column (say user_id).</p>
  
  <p>Is there a way to do it in MySQL?</p>