title: Add new row if it does not exists and get new id - MySQL
body: <p>I have a table</p>
  
  <pre><code>id(PK, AI)  name(UQ)
  1             mike
  2             ashly
  3             nash
  </code></pre>
  
  <p>I want users are able to add new names. But if <code>name</code> already exists I don't want to add it again, and get the already existing name's <code>id</code>. If name does not exist I want <code>new id</code> of <code>new name</code></p>
  
  <p>I have tried many queries but none of them worked. That's why I am not going to write them here.</p>
  
  <p>Thanks for help.</p>