title: Adding new field with Unique key index in existing MySQL table
body: <p>I am trying to add a column with Unique Key (so it will not have duplicate records) in existing MySQL table that contains multiple rows of data. </p>
  
  <pre><code>ALTER TABLE  `common`.`fraud_payment_log`
    ADD  `retainer_id` VARCHAR( 20 ) NOT NULL,
    ADD  `http_referrer` VARCHAR( 255 ) NULL ,
    ADD UNIQUE (`retainer_id`);
  </code></pre>
  
  <p>But it is throwing below error:</p>
  
  <pre><code>ERROR 1062 (23000): Duplicate entry '' for key 'retainer_id'
  </code></pre>
  
  <p>The error is because of the duplicate empty value which will come when we adding a new column in the existing table with records.</p>
  
  <p>Can anyone please suggest how to achieve this?</p>