MYSQL Unique Columns

MYSQL Add a Unique Column

The code below creates a new column called username to the table called mytable. The username must be unique. In other words, if you use an insert statement and a username already exists, the data will no be duplicated.

alter table mytable add unique (username);
ALTER TABLE `mytable` ADD UNIQUE (`username`)";