MySQL - Make an existing Field Unique -


i have existing table field should unique not. know because entry made table had same value another, existing, entry , caused problems.

how make field accept unique values?

alter ignore table mytbl add unique (columnname); 

for mysql 5.7.4 or later:

alter table mytbl add unique (columnname); 

as of mysql 5.7.4, ignore clause alter table removed , use produces error.

so, make sure remove duplicate entries first ignore keyword no longer supported.

reference


Comments

Popular posts from this blog

jQuery clickable div with working mailto link inside -

WPF: binding viewmodel property of type DateTime to Calendar inside ItemsControl -

java - Getting corefrences with Standard corenlp package -