Reputation: 314
A non-unique attribute of a table can be made unique by the query:
ALTER TABLE mytbl ADD UNIQUE (columnName);
I need to set a already unique attribute of a table NON-unique. Can anyone help me with the query?
Upvotes: 3
Views: 489
Reputation: 21007
First of all you want to get name of index, you can do that by SHOW INDEX IN mytbl
, then you can just ALTER TABLE
:
ALTER TABLE mytbl DROP INDEX auto_index_name;
Upvotes: 0
Reputation: 1155
alter table mytbl drop index columnName;
Use the above command for the same.
Upvotes: 2
Reputation: 12428
you can drop the unique index with the following statement:
ALTER TABLE mytbl
DROP INDEX columnName
Upvotes: 1
Reputation: 79979
Drop it, like so:
ALTER TABLE yourTable DROP INDEX ItsName;
Upvotes: 1