title: MySQL: Creating new unique field in already populated table
body: <p>I need to create a field in a database table, already populated with data. Of course just adding the field empty is not possible. I can only think of creating a new table with a new structure and copy the existing data to the new table, but I wonder if there is a n easier way. </p>
  
  <p>Hint: it is a composite key, comprised of 3 other fields in the same table.</p>
  
  <p>Edit: the field holds a varchar value
  Edit: since some of you ask, it is not possible to create a new UNIQUE field in a populated table just by using ADD UNIQUE. It duplicates the new (empty or not) value throughout all entries. Example:</p>
  
  <p>ALTER TABLE 'tablename' ADD 'fieldname' VARCHAR( 64 ) NOT NULL ,
  ADD UNIQUE (
  'fieldname'
  )</p>
  
  <p>error: Duplicate entry '' for key 'fieldname' </p>