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.
Comments
Post a Comment