setting a collumn to be unique in existing table
hi all
ive been looking on the mysql site but i cant find the syntax to set a
collumn in an existing table to be unique.
could someone please give an example of how to do this.
i believe it goes something like: alter table tblname add unique
colname
but i could be wrong
Re: setting a collumn to be unique in existing table
also the syntax to unset this would also be useful. thanks
Re: setting a collumn to be unique in existing table
mcyi2mr3 [at] googlemail.com wrote:
> also the syntax to unset this would also be useful. thanks
ALTER TABLE `my_table` ADD UNIQUE (`my_field`)
ALTER TABLE `my_table` DROP INDEX `my_field_index`
have a look at phpmyadmin