unique constraints in mysql
Posted December 4, 2012on:
1. how to show the current constraints of a table?
mysql> show create table table_name;
It will also show updates, not just what is being executed at the time of create table.
2. drop a unique constraint
mysql> alter table table_name drop index constraint_name;
even if you didn’t give the constraint a name when you created it, you can still find the name from the above ‘show create table’ command.
3. add a new unique constraint
mysql> alter table table_name add constraint constraint_name unique (column 1, column 2, …);