title: #1062 - Duplicate entry '' for key 'unique_id' When Trying to add UNIQUE KEY (MySQL)
body: <p>I've got an error on MySQL while trying to add a UNIQUE KEY. Here's what I'm trying to do. I've got a column called 'unique_id' which is VARCHAR(100). There are no indexes defined on the table. I'm getting this error:</p>
  
  <pre><code>#1062 - Duplicate entry '' for key 'unique_id' 
  </code></pre>
  
  <p>When I try to add a UNIQUE key. Here is a screenshot of how I'm setting it up in phpMyAdmin:</p>
  
  <p><img src="https://i.stack.imgur.com/t8Yai.png" alt="enter image description here"></p>
  
  <p>Here is the MySQL query that's generate by phpMyAdmin:</p>
  
  <pre><code>ALTER TABLE  `wind_archive` ADD  `unique_id` VARCHAR( 100 ) NOT NULL FIRST ,
  ADD UNIQUE (
  `unique_id`
  )
  </code></pre>
  
  <p>I've had this problem in the past and never resolved it so I just rebuilt the table from scratch. Unfortunately in this case I cannot do that as there are many entries in the table already. Thanks for your help!</p>