title: MySql How to prevent duplicate entry into database
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2219786/best-way-to-avoid-duplicate-entry-into-mysql-database">Best way to avoid duplicate entry into mysql database</a>  </p>
  </blockquote>
  
  
  
  <p>this  is my query to add the user and denying them if there already exists an user with the same name in the user table:</p>
  
  <pre><code>insert into  user values(?, ?, ?, ? ) select * from user 
  where NOT EXISTS(select * from user where user.username = ?);
  </code></pre>