title: sql - INSERT ON DUPLICATE KEY return msg
body: <p>I have a web app front end that uses nodeJS to facilitate connections and operations on a MySQL backend. I am looking for a way to implement a unique insert that returns an error message if it finds a duplicate key. Is there something I can implement along the lines of:</p>
  
  <pre><code>INSERT INTO clients set ? ON DUPLICATE KEY //SELECT "Error: Duplicate Entry" 
  AS "";
  </code></pre>
  
  <p>From there, what is the best way to retrieve this message and return it to the user on the web front end?</p>