title: What is the difference between UNIQUE, UNIQUE KEY and CONSTRAINT 'name' UNIQUE?
body: <p>I have a basic <code>users</code> table I want to create in MySQL. </p>
  
  <p>I do not want duplicate emails or duplicate usernames appearing in the database. </p>
  
  <ul>
  <li>What is the best way of preventing this upon table creation? </li>
  <li>And what is the difference between the following:</li>
  </ul>
  
  <p><strong>1.</strong>
      <code>UNIQUE (username), UNIQUE (email),</code></p>
  
  <p><strong>2.</strong>
      <code>UNIQUE KEY (username), UNIQUE KEY (email),</code></p>
  
  <p><strong>3.</strong>
      <code>CONSTRAINT ucons_login UNIQUE (username, email),</code></p>
  
  <p>I assume some of these are synonymous, yet I've been reading conflicting information online and was seeking confirmation. </p>
  
  <p>I hope someone can assist.</p>
  
  <p><strong>The SQL:</strong></p>
  
  <pre><code>CREATE TABLE users (
    user_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
    username VARCHAR(30) NOT NULL,
    pass CHAR(40) NOT NULL,
    first_name VARCHAR(20) NOT NULL,
    last_name VARCHAR(40) NOT NULL,
    email VARCHAR(60) NOT NULL,
    registration_date DATETIME NOT NULL,
    user_level TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
    active CHAR(32),
    PRIMARY KEY (user_id),
    UNIQUE (username),
    UNIQUE (email),
    INDEX login (email, pass),
    INDEX full_name (last_name, first_name)
  ) ENGINE=INNODB;
  </code></pre>