1 ) ALTER TABLE  `foo` ADD UNIQUE ( `bar` )  or   2 ) You do not have duplicates -> will apply the key without issues You do have duplicates -> will give an error message, nothing happened to your data All is unique, except several rows with NULL in them, unique constraint is still applied, as NULL is not checked when checking for unique values (you can have the entire table have a NULL value in a unique field without any error message).

Read more of this post